These are chat archives for andela/andela-21-lite
@mayreeh In the child
__init__ method you should also initialise the parent class. However I'm not sure the
Department class should be inheriting from the
User class, since a department can't have an employee ID
emp_id (or a department is not a user).
Inheritance is used to indicate that one class will get most or all of its features from a parent class.. One way you can check that -> a
child is a
parent e.g from the example in the link shared by @andela-jngatia above, the class
Pet. So you can say a dog is a pet...
class Pet(object): def __init__(self, name, species): self.name = name self.species = species def getName(self): return self.name def getSpecies(self): return self.species def __str__(self): return "%s is a %s" % (self.name, self.species) class Dog(Pet): def __init__(self, name, chases_cats): Pet.__init__(self, name, "Dog") self.chases_cats = chases_cats def chasesCats(self): return self.chases_cats