Capgemini Interview Question

the coding question to implement inheritance and polymorphism