-2

I don't want to make the base class from being derived to a new class. Is there any way to achieve this? I want to tell the compiler that you can't inherit the base class just like a final keyword in java

1 Answers1

5

You can mark the class as final to prevent derivation from it. E.g:

class A final { ... };
Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271