✏️ Explanatory Question

What is the difference between public, protected, and private attributes in Python?

👁 298 Views
📘 Detailed Answer
298
Total Views
10
Related Qs
0%
Progress
💡

Answer with Explanation

Answer: Public attributes can be accessed and modified from anywhere in the program. Protected attributes can only be accessed and modified by the class and its subclasses. Private attributes can only be accessed and modified by the class, and not its subclasses or other modules.