πŸ“Š Python
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

πŸ‘οΈ
69
Total Visits
πŸ“½οΈ
11 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate