-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritance.py
More file actions
42 lines (28 loc) · 990 Bytes
/
inheritance.py
File metadata and controls
42 lines (28 loc) · 990 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
# # Inheritance
'''
--> Inheritance allows a class to Inherit attributes and methods from another class, facilitating reuse.
--> Consider human families. characteristics like surname, traditions, or physical features can be passed down from parents to children.
'''
# class Family:
# def __init__(self,surname):
# self.surname = surname
# class child(Family):
# def __init__(self,surname,name):
# super().__init__(surname)
# self.name = name
# Child = child("Gowda","Hemi")
# print(f"{Child.surname} {Child.name}")
# class user:
# def __init__(self,username,password):
# self.username = username
# self.password = password
# def login(self):
# print(f"{self.username} logged in")
# class Admin(user):
# def delete_user(self):
# print("Admin deleted user")
# a = Admin("Hemi",1234)
# print(a.username)
# print(a.password)
# a.login()
# a.delete_user()