A

Admin • 833K Points
Coach

Q. How can we prevent a class from being inherited?

  • (A) By using `final` keyword
  • (B) By using `@noinherit` decorator
  • (C) Python doesn't have built-in support to prevent inheritance
  • (D) By setting `__inherit__ = False`
  • Correct Answer - Option(C)
  • Views: 21
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

Python doesn't have a `final` keyword. Preventing inheritance needs custom metaclass tricks.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.