|
|
|
|
|
by bjw181
3512 days ago
|
|
What is encapsulation in any language? Put simply, we encapsulate mainly to prevent mistakingly altering data. For example, private methods and variables. Class Foo:
def __init__(self):
self.__im_private()
def bar(self):
print('baz')
def __im_private(self):
print('back off, I can only be called by the class')
|
|