Update page 'Day 7 homework - Sloejtes'

xuanyi.wang
2023-04-13 00:36:56 +02:00
parent b3113f424b
commit cccb98111b
+4
@@ -147,7 +147,9 @@ class Bike(Vehicle):
* In this example, `Vehicle` class is the virtual base class that defines the shared methods and properties of the `Car` and `Bike` classes. The `num_wheels` property and `start` method are abstract methods that must be implemented in the concrete classes. The `stop` method is a non-abstract method that is the same for both `Car` and `Bike` objects. * In this example, `Vehicle` class is the virtual base class that defines the shared methods and properties of the `Car` and `Bike` classes. The `num_wheels` property and `start` method are abstract methods that must be implemented in the concrete classes. The `stop` method is a non-abstract method that is the same for both `Car` and `Bike` objects.
* The `Car` and `Bike` classes inherit from `Vehicle` and define the non-abstract methods and properties that are specific to each object. The `num_wheels` property and `start` method are implemented differently in each class. * The `Car` and `Bike` classes inherit from `Vehicle` and define the non-abstract methods and properties that are specific to each object. The `num_wheels` property and `start` method are implemented differently in each class.
##### Implementation: ##### Implementation:
``` ```
obj_car=Car() obj_car=Car()
obj_bike=Bike() obj_bike=Bike()
@@ -161,7 +163,9 @@ print(obj_bike.num_wheels)
print(obj_car.stop()) print(obj_car.stop())
print(obj_bike.stop()) print(obj_bike.stop())
``` ```
###### Output: ###### Output:
``` ```
Starting the car engine. Starting the car engine.
None None