Inheritence

Is it possible to make a class non extendable???
make all elements/members private or use final keyword
@tath

final is not supported by C++, i guess,

and making all elements/member private will not solve the problem. we can still inherit the class, but we cannot Access the base class variable in extended class.
final is a C++11 keyword that marks a virtual function as the final override.

I don't know about non-extendable, but you can protect your class's data members by keeping them private. That way, any derivation would be forced to use your class's interface to modify anything.
Topic archived. No new replies allowed.