python上课笔记9-类

9-1

#9-1
class restaurant():
    def __init__(self , name , type):
        self.restaurant_name = name
        self.cuisine_type = type 

    def describe_restaurant(self):
        print(self.restaurant_name)

    def open_restaurant(self):
        print(self.cuisine_type)

dog = restaurant("123" , "11111111")
dog.open_restaurant()
dog.describe_restaurant()

你可能感兴趣的:(python)