# Classes : 'Pink'
# Classes : 'Pink'
V3 = V1 + V2 @staticmethod
V4 = V1 * V2 def Description():
print("This is a class for Cars")
V3.Print()
V4.Print()
Car.Description()
# OOP: Encapsulation -------------
# Data Hiding
# Implementation details should be hidden
class Persion:
def __init__(self, n, a1='Tom',
a2='BigFish'):
self.name = n
self._alias1 = a1
self.__alias2 = a2
def ShowName(self):
print(self.name)
self._ShowAlias()
def _ShowAlias(self):
print(self.__AliasFormat())
def __AliasFormat(self):
return "Alias Name1: " +
self._alias1 +'\nAlias Name2: ' +
self.__alias2 + '\n'
P1 = Persion("John")
P1.ShowName()
P1._ShowAlias() # can be access but
signal not to do it
try:
P1.__AliasFormat() # Can Not Access
except:
print("Acess Error")
print('------------------')
# Static Methods
class Car: