Apr-21-2022, 11:19 AM
(Apr-21-2022, 10:28 AM)menator01 Wrote: Please use tags when posting code.
Maybe something like this
class A: def __init__(self, name, age): self.name = name self.age = age def details(self): print (self.name) obj = A('Ramesh', 62) obj.details() class B: def __init__(self, name, id): self.name = name self.id = id def details1(self): print (self.name) obj = B('Ram', 1234) obj.details1() class C(A,B): print("Just inside class C") def __init__(self): A.__init__(self, 'name me', 23) # calling class A constructor print('Calling Class A constructor') def get_details(self): A.details(self) print(A.details(A.self.name)) obj = C() obj.details()
Output:Ramesh Ram Just inside class C Calling Class A constructor name me
Thanks a ton for immediate response to my very basic in python. Pardon me for asking such questions, but wish to learn on my own. Real pleasure and elated to get immediate response. Thank you once again.
Note: will use tags in future.