One of the
key features of C++ classes, and certainly one of the most useful for
WCM, is inheritance
. Inheritance allows creating classes which are derived from other
classes, so that they automatically include its "parent's" member
functions, character definitions and decals, plus its own, which may
overwrite or supersede the definitions in the parent class. We will
examine ways to do this in the next few sections, but first we will
look at modifying the example presented in the previous section.
For example if we want to create an advanced
callout balloon class based on implemented in previous section (to
support scaling for example) we can do this by deriving a new class
from
CalloutBalloon
:
…
// see the notes after this example for an
explainatin of the ":" notation
Line
class CalloutBalloonEx : public CalloutBalloon
means that we declare a new sub-class
CalloutBalloonEx
which is derived from
CalloutBalloon
. Deriving means that all member functions and character definitions of
CalloutBalloon
will be accessible the same way in
CalloutBalloonEx
Constructors are
not
inherited, however! We need to create a new constructor! Line
CalloutBalloonEx ( string sText ) : CalloutBalloon ( sText )
declares a new constructor for class
CalloutBalloonEx
with one string parameter sText. Before we add any additional
initialization, however, we want to call the constructor of inherited
class
CalloutBalloon
by calling it with parameter
sText
. In this case,
CalloutBalloonEx
does not require any additional initialization so it has an empty body.
But there are more complex examples possible where additional
initialization is required.
It is possible to add new member functions to the new sib-class. For
example,
SetScale
is a new member function.
It is also possible to overwrite the member functions of the parent
class.
SetPos
was already declared in
CalloutBalloon
but here we define it to behave a little differently in
CalloutBalloonEx
in order to take into account the current scale factor.
The new sub-class can be
used in the same way as the parent class:
Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi
There is a prototype of simple online character designer available
HERE. It is only a prototype,
it does not contain many pieces yet but it can already generat
Web Cartoon Maker 1.5 is finally here! You can download it
HERE!
Here is what was updated in version 1.5:
Web Cartoon Maker Desktop Edition is now fully standal