-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession10.py
More file actions
59 lines (39 loc) · 1.22 KB
/
session10.py
File metadata and controls
59 lines (39 loc) · 1.22 KB
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
56
57
58
59
class Login:
def loginUser(self):
print(">> Login dear User !!")
class GoogleLogin(Login):
def loginUser(self, email, password):
print(">>Google Login done")
class OTPLogIn(Login):
def loginUser(self, phone):
print("Login done through otp")
class FacebookLogin(Login):
def loginUser(self):
print("Facebook login done")
class Cab:
def bookCab(self, source, destination):
print("Cab booked from {} to {}".format(source, destination))
class MicroCab(Cab):
def bookCab(self, source, destination):
print("Ola micro Cab booked from {} to {}".format(source, destination))
class MiniCab(Cab):
def bookCab(self, source, destination):
print(" Mini Cab booked from {} to {}".format(source, destination))
# In python, everything is dynamic.. (Run time)
# Run time Polymorphism
login = Login()
login.loginUser()
print()
login = GoogleLogin()
login.loginUser("ayushi@99", "pass123")
print()
login = OTPLogIn()
login.loginUser("1235487")
print()
# Same reference variable can point to different objects- >Polymorphism
cab = Cab()
cab.bookCab("Silver arc", "Mbd")
cab = MicroCab()
cab.bookCab("Silver ", "to mbd")
cab = MiniCab()
cab.bookCab("Silver ", " to mbd")