Apr-03-2019, 10:09 AM
Hi Team,
Please find the below code
now i have created one instance obj1 = B("Chennai"). Instead of calling the "fun" from class B, i want to call a "fun" from class A.
is it possible to call a class A "fun" from created instance.
thanks in advance
Kamal
Please find the below code
class A () : def __init__(self,name): self.name = name def fun(self): print("The name is " , self.name) class B(A) : def __init__(self,Location): A.__init__(self,name) self.Location = Location def fun(self): print("The Location is " , self.Location) obj1 = B("Chennai") x = obj1.fun()Class A and Class B contains similar method name "fun"
now i have created one instance obj1 = B("Chennai"). Instead of calling the "fun" from class B, i want to call a "fun" from class A.
is it possible to call a class A "fun" from created instance.
thanks in advance
Kamal