代码第10行不是已经提供了实参(China Kongfu,川菜)了吗,为什么错误中还显示Restaurant没有带参数
__init__
是两个下划线
是__init__两个下划线
class Restaurant:
def __init__(self, _name, _type):
self.restaurant_name = _name
self.cuisine_type = _type
def describe_restaurant(self):
print(f"the restaurant's name is {self.restaurant_name}")
def open_restaurant(self):
print(f"the restaurant's type is {self.cuisine_type}")
restaurant = Restaurant('China Kongfu', '川菜')
restaurant.describe_restaurant()
restaurant.open_restaurant()
# the restaurant's name is China Kongfu
# the restaurant's type is 川菜