From 8ab64a042f0138b7b259e4f82e0d0ab564f27e34 Mon Sep 17 00:00:00 2001 From: Kavyapanakala <146448609+Kavyapanakala@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:35:12 +0530 Subject: [PATCH] Create inheritance.py --- inheritance.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 inheritance.py diff --git a/inheritance.py b/inheritance.py new file mode 100644 index 0000000..3ec58ed --- /dev/null +++ b/inheritance.py @@ -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()