Update page 'Day 7 homework - Sloejtes'
@@ -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.
|
||||
|
||||
* 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:
|
||||
|
||||
```
|
||||
obj_car=Car()
|
||||
obj_bike=Bike()
|
||||
@@ -161,7 +163,9 @@ print(obj_bike.num_wheels)
|
||||
print(obj_car.stop())
|
||||
print(obj_bike.stop())
|
||||
```
|
||||
|
||||
###### Output:
|
||||
|
||||
```
|
||||
Starting the car engine.
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user