We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eccf6bf commit 65ff6a3Copy full SHA for 65ff6a3
Module3_OOPs_Key_Concepts_in_Python/inheritance.py
@@ -0,0 +1,28 @@
1
+class Vehicle:
2
+ def general_usage(self):
3
+ print("general use: transporation")
4
+
5
+class Car(Vehicle):
6
+ def __init__(self):
7
+ print("I'm car")
8
+ self.wheels = 4
9
+ self.has_roof = True
10
11
+ def specific_usage(self):
12
+ self.general_usage()
13
+ print("specific use: commute to work, vacation with family")
14
15
+class MotorCycle(Vehicle):
16
17
+ print("I'm motor cycle")
18
+ self.wheels = 2
19
+ self.has_roof = False
20
21
22
23
+ print("specific use: road trip, racing")
24
25
+c = Car()
26
+m = MotorCycle()
27
28
+print(issubclass(Car,MotorCycle))
0 commit comments