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:
Behavior of overridden constructors and destructors in an inheritance tree
Behavior of constructors and destructors under exception-handling conditions
Importance of default constructors (constructors with no arguments)
Time at which a destructor or finalizer is called
Wisdom of overriding the language's built-in operators, including assignment and equality
How memory is handled as objects are created and destroyed or as they are declared and go out of scope
Detailed discussions of these issues are beyond the scope of this book, but the "Additional Resources" section points to good language-specific resources.
3.147.59.198