# 1 ~ 2 자동차 클래스 작성 - 제조사 색상 가격 모델명
"""
class Car:
def __init__(self, company='기아', model='K7', color='블랙', price='사천'):
self.__company = company
self.__model = model
self.__color = color
self.__price = price
def car_info(self):
print('회사 : ', self.__company, end=' ')
print('모델 : ', self.__model, end=' ')
print('색상 : ', self.__color, end=' ')
print('가격 : ', self.__price, end=' ')
def car_name(self, name):
self.__model = name
#getter
@property
def price(self):
return self.__price
#setter
@price setter
def price(self,new_price):
self.__price = new_price
if __name__ == '__main__':
ca1 = Car('현대', '그랜저', '흰색', '4천')
ca1.car_info()
ca2 = Car()
ca2.car_info()
ca3 = Car()
ca3.car_name('몰라')
ca3.car_info()
ca3.price = '3천만'