Virtual function: Difference between revisions

Content deleted Content added
Line 48:
 
This allows a programmer to process a list of objects of class <code>Animal</code>, telling each in turn to eat (by calling <code>eat</code>), without needing to know what kind of animal may be in the list, how each animal eats, or what the complete set of possible animal types might be.
 
=== C ===
 
In C, the mechanism behind virtual functions could be provided in the following manner: