As mentioned earlier,
C++ is generally considered an object-oriented
programming (OOP) language
. One of the features of OOP is that it provides a way to define objects
that behave very much like real world objects. For example, the class
Point we defined before, obviously corresponds to the way people think
about coordinates on the screen or in the movie, and the operations we
defined (
GetDistance
,
Reflect
and
GetReflectedCopy
) correspond to the sorts of things people do with these coordinates.
So far, though, we have not taken advantage of the features C++ provides
to support object-oriented programming (except using internal WCM
objects). Strictly speaking, these features are not necessary. For the
most part they provide an alternate syntax for doing things we have
already done, but in many cases the alternate syntax is more concise
and more accurately conveys the structure of the program.
For example, at first glance there is no obvious connection between
class
Point
and functions
GetDistance
,
Reflect
and
GetReflectedCopy
. With some examination, it is apparent that these functions take at
least one point object as an argument.
This observation is the motivation for member
functions
or so called methods
. Member functions differ from the other functions we have written in
two ways:
When we call the function, we invoke it on an object, rather than just
call
it. People sometimes describe this process as “performing an operation
on an object,” or “sending a message to an object.”
The function is declared inside the
class
definition, in order to make the relationship between the structure and
the function explicit.
Note: It was mentioned earlier that the names “function” and “method”
are used differently in different languages and, in informal
discussions, are essentially the same. “Method” and “Member Function”
as used in this section have very specific C++ definitions.
In the next few sections, we will take
some functions and transform them into member functions or C++ methods.
One thing you should realize is that this transformation is purely
mechanical; in other words, you can do it just by following a sequence
of steps.
Anything that can be done with a member function can also be done
with a nonmember function (sometimes called a free-standing function).
But sometimes there is an advantage to one over the other. If you are
comfortable converting from one form to another, you will be able to
choose the best form for whatever you are doing.
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