Virtual methods enable subtype polymorphism - in other words, they allow implementing different behavior in descendant classes.
That means if you have a base TShape class with a virtual Paint method, and several descendant classes like TRectangle, TCircle and TTriangle, then each of those subclasses can implement a different Paint method to appropriately paint itself. You can call the Paint method on any shap
Weiterlesen...