W3School TIY Editor
(追記) (追記ここまで)
W3School 在线教程
class Vehicle: def __init__(self, brand, model): self.brand = brand self.model = model def move(self): print("移动!") class Car(Vehicle): pass class Boat(Vehicle): def move(self): print("航行!") class Plane(Vehicle): def move(self): print("飞行!") car1 = Car("福特", "野马") #创建 Car 对象 boat1 = Boat("伊比萨", "Touring 20") #创建 Boat 对象 plane1 = Plane("波音", "747") #创建 Plane 对象 for x in (car1, boat1, plane1): print(x.brand) print(x.model) x.move()
[
フレーム
]
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル