Content deleted Content added
m →Example |
|||
Line 30:
To be more explicit about the above example, let us consider the case where we have a base class with '''no virtual functions'''. Whenever the base class calls another member function, it will always call it's own base class functions. When we inherit from this class, a derived class, we inherit all the member variables and member functions that weren't overridden (no constructors or destructors, of course, either). If the derived class calls an inherited function that then calls another member function, it will never call any derived member functions. As a result of this behaviour, most C++ programmers define member functions as virtual to avoid this problem.
However, if
==See also==
|