In this we are going to see a basic program of house inheritance using hierarchical inheritance in Python Programming Language.
class location:
hloc = "New York"
bloc = "Hamshire"
def display_loc(self):
print(
f"Location of house: {self.hloc} and location of builder's office: {self.bloc}")
class houseDim(location):
height = "572ft"
size = "2800sqft"
def display_Dim(self):
print("This house is " + self.height + " and size is " + self.size)
class build(location):
architect = "John Doe"
builder = "Richards hamburgers"
def display_officials(self):
print("The architect is " + self.architect +
" and builder is " + self.builder)
dim = houseDim()
b = build()
dim.display_loc()
dim.display_Dim()
b.display_officials()
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP