Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions inheritance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Python program to demonstrate
# multiple inheritance

# Base class1
class Mother:
mothername = ""

def mother(self):
print(self.mothername)

# Base class2


class Father:
fathername = ""

def father(self):
print(self.fathername)

# Derived class


class Son(Mother, Father):
def parents(self):
print("Father :", self.fathername)
print("Mother :", self.mothername)


# Driver's code
s1 = Son()
s1.fathername = "RAM"
s1.mothername = "SITA"
s1.parents()