Oops 1
Oops 1
2. State the difference between Public and Private access modifier in python.
ANS-Public: Public attributes and methods can be accessed from both inside and outside the
class. In Python, by default, all attributes and methods are public unless specified otherwise.
Private: Private attributes and methods are intended to be used only within the class. In
Python, they can be made private by prefixing the attribute or method name with double
underscores (__). This adds name mangling, making it harder to access from outside the
class.
ANS-Abstraction is an OOP concept that involves hiding complex implementation details and
exposing only the essential features. By focusing on the high-level functionality rather than
the intricate workings, abstraction allows users to interact with an object or system without
needing to understand its complexity.