运行 ❯
拥有你自己的 Python 服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
class Car: def __init__(self, brand, model): self.brand = brand self.model = model def move(self): print("Drive!") class Boat: def __init__(self, brand, model): self.brand = brand self.model = model def move(self): print("Sail!") class Plane: def __init__(self, brand, model): self.brand = brand self.model = model def move(self): print("Fly!") car1 = Car("Ford", "Mustang") #Create a Car class boat1 = Boat("Ibiza", "Touring 20") #Create a Boat class plane1 = Plane("Boeing", "747") #Create a Plane class for x in (car1, boat1, plane1): x.move()
开车!
航行!
飞翔!