Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 6)
6.
How does Python support encapsulation in the context of inheritance?
By making all attributes public
By using private attributes and methods
By restricting inheritance
By removing the need for constructors
Answer: Option
Explanation:
Python supports encapsulation by allowing the use of private attributes and methods, denoted by a double underscore (e.g., __private_attribute), which are only accessible within the class.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.