Objects in C++ (II)
- Member functions are defined just like normal functions except
they must have the class-name:: junk before their name
(and after their type!).
- Member functions may use any other member function or member
data without needing the object-name. qualification. It
doesn't matter whether the the function/data is private or public.
- All of the member functions are typically put in their own
file, usually called class-name.C. All of the interface
is usually put in class-name.h. If all is well planned,
you could replace both files with new ones based on an entirely
different implementation (storing the triangle's internal angles
or vertex coordinates, for example), and as long as the public
interface is the same, nothing else should be affected.
Next Slide