< Free Open Study > |
Approaches to classes in different programming languages vary in interesting ways. Consider how you override a member routine to achieve polymorphism in a derived class. In Java, all routines are overridable by default and a routine must be declared final to prevent a derived class from overriding it. In C++, routines are not overridable by default. A routine must be declared virtual in the base class to be overridable. In Visual Basic, a routine must be declared overridable in the base class and the derived class should use the overrides keyword. Here are some of the class-related areas that vary significantly depending on the language:
Detailed discussions of these issues are beyond the scope of this book, but the "Additional Resources" section points to good language-specific resources. |
< Free Open Study > |