W3Schools Tryit Editor
[
フレーム
]
Run ❯
Get your
own Python
server
Go to Spaces
Ctrl+Alt+P
class Vehicle: def __init__(self, brand, model): self.brand = brand self.model = model def move(self): print("Move!") class Car(Vehicle): pass class Boat(Vehicle): def move(self): print("Sail!") class Plane(Vehicle): def move(self): print("Fly!") car1 = Car("Ford", "Mustang") #Create a Car object boat1 = Boat("Ibiza", "Touring 20") #Create a Boat object plane1 = Plane("Boeing", "747") #Create a Plane object for x in (car1, boat1, plane1): print(x.brand) print(x.model) x.move()
Ford
Mustang
Move!
Ibiza
Touring 20
Sail!
Boeing
747
Fly!
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル