Python - Object Oriented Programming | Encapsulation

preview_player
Показать описание
Python Encapsulation
Python Object Oriented Programming, Python OOP concepts
What are the benefits of using Encapsulation in Python
Python Private public methods and variables

--You May Also Like --

==================FOLLOW ME ==================

Subscribe for New Releases!

(ask me questions!)

--- QUESTIONS? ---

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Thanks for all your support!
Рекомендации по теме
Комментарии
Автор

Can't believe a level 9999 Indian overlord explained this way better in 8 minutes than my top ranked college did.

miwwie
Автор

Thank you mister, finally I'm able to use proper encapsulation in python!

guilhermecampos
Автор

Crystal clear explanation! Salute to you sir.

minhkhoi
Автор

Wow gotta say the best video ever. I wish he was my programming professor. To be honest programmers on YouTube are better than some professors we have in the U.S universities.

Nahzh-mr
Автор

class Payment:

def __init__(self, price):
self.__final_price = price + price * 0.02


book = Payment(100)
book.__final_price = 0
print(book.__final_price)

output - 0

the value of the final_price variable is changing what's happening?

jayantyadav
Автор

hello!!, you didnt explain about the 9th line, kindly check and try to explain what u have done in the line 9 in your code>

moneshmjc
Автор

6:24, how are you using the 'discount' parameter without instantiating it?

rupshaghosh
Автор

Thanks ❤❤❤❤ lot you made it very easy 😊 where from buddy

shivastar
Автор

loved the way you teach, do you have anything for Django also?? (videos playlist)

rihanansari
Автор

gr8 explanation, thanks for uploading

I have a doubt however, when i tried to access the pvt variable it gave an error as expected but it also suggest to use objectname._A__name , meaning I am able to edit the pvt variable using it, can somone pls tell how we can prevent that ```class A:

def __init__(self, name):
self.__name = name

def show(self):
return self.__name
def setter(self, newname):
self.__name = newname


a = A("akash")
a.setter("lokesh")
a._A__name = "tommy"
print(a.show())```

>>>tommy

akashgeorge
Автор

A better explanation but not quite easy.

skhumbuzocele
Автор

You changed the 9th line into commentary. If you hadn't done that, the final price would've still been changed.
That some bad teaching here. >:(

raphaelchagas
Автор

Single underscore is protected. And double is private. Stop fooling. Its nothing such thing like warning

arymanusingh