from Car import *
from Airplane import *
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
# main guard
if __name__ == "__main__":
Main.main()
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
plane = Airplane("Plane", 123, 45)
print(plane.name)
print(plane.describe())
print(plane.move(10))
car = Car("Car", 4)
print(car.name)
print(car.describe())
print(car.move(10))
Plane
I am an airplane with a wingspan of 123 and capacity 45
Landing gear up
Moving
Landing gear down
10.0
Car
I'm a sedan
Moving
10.0
class Main:
@staticmethod
def main():
car = Car("Car", 4)
print(car.honk_horn())
class Main:
@staticmethod
def main():
car = Car("Car", 4)
print(car.honk_horn())
class Main:
@staticmethod
def main():
car = Car("Car", 4)
print(car.honk_horn())
Rules
- Treat child class as any parent class
- Use attributes and methods based on object class and any parent classes
- Overriden methods will use code in child class
class Main:
@staticmethod
def main():
vehicles = []
vehicles.append(Airplane("Plane", 123, 45))
vehicles.append(Car("Car", 4))
vehicles.append(Truck("Truck", 157))
for v in vehicles:
print(v.name)
print(v.describe())
print(v.move(10))