January 2011
Intermediate to advanced
1648 pages
70h 30m
English
To illustrate the concept of virtual members from a different angle, let’s define another type hierarchy in which we declare virtual members ourselves (rather than overriding the ones from System.Object). A good example is the concept of a Shape that can be queried for its area and circumference. Depending on the subclass of Shape, calculation of those values will differ:

For the time being, we use default implementations for those virtual property getters, which don’t look as if they produce very meaningful values. Later on, after you’ve learned about abstract classes and members, we discuss how to omit such an implementation ...
Read now
Unlock full access