Program implementing inheritance and polymorphism