I'm very new to python. I'm trying to execute the following code but getting error. As per my understanding C Class inherits from A and B. So it should have the instance variables from both. Could you please help me out?
class A:
def __init__(self):
self.bar = "Bar"
self.name = "Gautam"
class B:
def __init__(self):
self.foo = "Foo"
self.name = "Nayak"
class C(A, B):
def __init__(self):
super().__init__()
def showProps(self):
print(self.name, self.bar, self.foo)
c = C()
c.showProps()
Error: AttributeError: 'C' object has no attribute 'foo'