سلام وقت بخیر چرا در کد من وقتی جای کلاس sellو Apartement را عوض میکنیم خروجی مورد نظر رو نمیتونم در یافت کنم وقتی اول کلاس sell رو مینویسم و بعدکلاس Apartementرو خروجی صحیح هست ولی جاهاشون رو که عوض میکنم خروجی به صورت زیر هست:
price: price_per_meter discountable: discountable convertable: convertable
قسمتی از کدها به شکل زیر هست:
class Apartement(EstateAbstract):
def __init__(self, has_elevator, has_parking, floor, *args, **kwargs):
self.has_elevator = has_elevator
self.has_parking = has_parking
self.floor = floor
super().__init__(*args, *kwargs)
def show_description(self):
print(f"Apartement: {self.id}\t area:{self.has_parking}")
class Sell(ABC):
def __init__(self, price_per_meter, discountable, convertable, *args, **kwargs):
self.price_per_meter = price_per_meter
self.discountable = discountable
self.convertable = convertable
super().__init__(*args, **kwargs)
def show_price(self):
print(f"price: {self.price_per_meter}\t discountable: {self.discountable}\t convertable: {self.convertable}")
class ApartementSell(BaseClass,Sell,Apartement ):
def show_detail(self):
self.show_description()
self.show_price()
reg1 = Region(name='R1')
apt1 = Apartement(has_elevator=True, has_parking=True, floor=2,user=User.objects_list[0], area=80, rooms_count=2,
built_year=1383,region=reg1, address="some text....")
apartement_sell = ApartementSell( has_elevator=True, has_parking=True, floor=2,user=User.objects_list[3], area=20, rooms_count=3,
built_year=1354,region=reg1, address="some text....",
price_per_meter=450 , discountable=True, convertable=False)
apartement_sell.show_detail()