2.8.1.2 Access Modifiers
Python Programming
Access modifiers are keywords or mechanisms that define the accessibility of classes, methods, and variables. In python there are following access modifiers:
- Public: Attributes and methods that are accessible from outside the class.
python
class Car:
def __init__(self , color): self.color = color # Public property- Protected: Attributes and methods are accessible within the class and its subclasses (derived classes).
python