devxlogo

August 24, 2005

The ‘final’ class in C++

Suppose you need to prevent the derivation of a class?like in the final classes of Java. Simply make the constructor of the class private. Here’s an example: class final{private: final(){}