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`
πŸ’¬ Discuss
βœ… Correct Answer: (C) Python doesn't have built-in support to prevent inheritance
Explanation: Python doesn't have a `final` keyword. Preventing inheritance needs custom metaclass tricks.
Explanation by: Mr. Dubey
Python doesn't have a `final` keyword. Preventing inheritance needs custom metaclass tricks.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
77
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
99%
Success Rate