Someone can help me to correct this error ? thanks (I'm trying to access a variable in the mother class in the daughter class)
class Animal:
def __init__(self, name):
self.name = name
class Mammal:
def Presentation(self):
print(self.name + "is a mammal")
dog = Animal("Dog")
dog.Mammal.Presentation()
Traceback (most recent call last): File "", line 11, in TypeError: Presentation() missing 1 required positional argument: 'self1'
Mammalobjects will have aself.nameattribute? it isn't assigned anywhere? What do you believe nesting a class definition inside another class definition does? It does not create an inheritance relationship. In fact, it doesn't really do anything useful at all, except perhaps keep namespaces seperateself, hence the error.