Initially this was defined
class Mammal(object):
def __init__(self, name):
self.name = name
def get_name(self):
return self.name
def say(self):
return("What does the " + self.name + " says")
but now we want to create subclasses of Mammals, whose constructor will call the Mammal's constructor with the correct name.
class Dog(Mammal):
def __init__(self):
Dog.self
This is my code. It says type object 'Dog' has no attribute 'self'
what's the problem?
when print(Dog().get_name())
I should get Dog.