Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Public | Encapsulation
In-Depth Python OOP
course content

Contenuti del Corso

In-Depth Python OOP

In-Depth Python OOP

1. OOP Concepts
2. Inheritance
3. Encapsulation
4. Polymorphism and Abstraction
5. Magic Methods

book
Public

The public access type is a regular access modifier that we used in previous sections.

You should use the public access modifier for attributes/methods that can be used outside the class. Its public information can be used by other tools inside the code.

12345678910
class SomeClass: attribute = "Public" def method(self): print("You can use it everywhere in your code") instance = SomeClass() print(instance.attribute) instance.method()
copy

These attributes/methods are used to get information about the class or manipulate the class in code.

question mark

How to define public attribute?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 2
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt