These are chat archives for andela/andela-21-lite

May 2016
May 25 2016 13:53
output : (1, 'name1'),
(2, 'name2'),
(3, 'name3'),
(4, 'name4'),
(5, 'name5'),
(6, 'name6')]
May 25 2016 15:10
@andela-egichuri Thanks thou (Sorry for my poor code formatting... :D ) thou , they are two classes, User and Department , where Department inherits User.... so i guess the class Department will be class Department)User) so my question is , while calling the subclass , now must you pass the values in super class which has been inherited from.
Eric G
May 25 2016 17:14

@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).
Remember 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 Dog inherits Pet. So you can say a dog is a pet...

The link:

class Pet(object):

    def __init__(self, name, species): = name
        self.species = species

    def getName(self):

    def getSpecies(self):
        return self.species

    def __str__(self):
        return "%s is a %s" % (, 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