devxlogo

Disabling Further Derivation of a Class

Disabling Further Derivation of a Class

Although the advantages of disabling further derivation of a class are often doubtable, C++ allows you to do that by declaring a class’s constructor and other special member functions private. This way, classes that attempt to inherit from that class will cause a compilation error due to an inaccessible base constructor:

 class Firewall{public: //

devx-admin

Share the Post: