Intro to OOP (Object Oriented Python 3.10) - Lesson 5 - Public, Private and Protected

Опубликовано: 22 Октябрь 2024
на канале: MrRaychambers
302
4

Here is a summary of what you will learn about in this video. This will introduce Public, Private and Protected attributes in Python.

Public - No changes need to be made, you can simply use self.name = name etc...

Private - Private methods mean that you can only use them inside the class. It'll give you an error as soon as you try to use it outside of the class.

Protected - It's more of a naming convention in Python and you can still access it. The idea is that you should only be able to use it within the class and subclasses.