Python Basics7(init method2)
class GrandParent():
def __init__(self,h):
self.house=h;
def GrandParentproperties(self):
print("grandparent house is"+self.house);
class Parent(GrandParent):
def __init__(self,h,c):
self.house=h;
self.car=c;
def Parentproperties(Self):
print("Parent house is"+self.house);
print("Parent house is"+self.car);
sub1=Parent('duplexhouse','honda');
sub1.Parentproperties();
sub1.GrandParentproperties();
def __init__(self,h):
self.house=h;
def GrandParentproperties(self):
print("grandparent house is"+self.house);
class Parent(GrandParent):
def __init__(self,h,c):
self.house=h;
self.car=c;
def Parentproperties(Self):
print("Parent house is"+self.house);
print("Parent house is"+self.car);
sub1=Parent('duplexhouse','honda');
sub1.Parentproperties();
sub1.GrandParentproperties();
Comments
Post a Comment