Skip to Content
Learn
Classes
Overriding methods

Since our ElectricCar is a more specialized type of Car, we can give the ElectricCar its own drive_car() method that has different functionality than the original Car class’s.

Instructions

1.

Inside ElectricCar add a new method drive_car that changes the car’s condition to the string "like new".

Then, outside of ElectricCar, print the condition of my_car

Next, drive my_car by calling the drive_car function

Finally, print the condition of my_car again

Folder Icon

Take this course for free

Already have an account?