« All Events
6 PM – Python OOP – Bill
November 5, 2022 @ 6:00 pm - 7:00 pm
Today We:
- Reviewed class inheritance
- Went over method overriding
Your HW:
- Create a new file in the MonsterInheritence src folder called Nov_5_InheritenceHW.py
- Create a vehicle class
- attributes: color, speed, capacity
- methods: get_info: returns information about the vehicle; drive: prints out “<color> vehicle drives at <speed> mph”
- Create a Car class
- Make it inherit from vehicle
- attributes: brand
- You will need to make color, speed, and capacity parameters in the __init__
- Override the drive method to print out “<color> <brand> car drives at <speed> mph”