Can anyone tell how to create class so that it can not be inherited by any other classes.
class A {
public :
int a;
int b;
};
class B : class A {
public :
int c;
};
in above program i do not want to allow other classes to be inherited by class B
Mark the class final
(since C++11):
class A final {
public :
int a;
int b;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With