-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.py
More file actions
55 lines (36 loc) · 930 Bytes
/
class.py
File metadata and controls
55 lines (36 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Vehicle:
def __init__(self):
print('You have created the Vehicle class')
class Truck(Vehicle):
def __init__(self):
print('You have created the Truck class')
def wheels(self):
print('Your vehicle has 8 wheels')
class Car(Vehicle):
def __init__(self):
print('You have created the Car class')
def wheels(self):
print('\nYour vehicle has 4 wheels')
def own(self):
print("\nIt's just a car !!")
class BMW(Car):
def __init__(self):
print('You have created the BMW class')
def own(self):
print('You own a BMW Car !!')
class Audi(Car):
def __init__(self):
print('You have created the Audi class')
def own(self):
print('You own a Audi Car !!')
v1 = Vehicle()
c1 = Car()
t1 = Truck()
b1 = BMW()
a1 = Audi()
c1.wheels()
t1.wheels()
c1.own()
b1.own()
a1.own()
print(globals())