Justin Tan wrote:If I had done Employee p = new Employee(); and Student a = new Student(); to create the objects would it have been wrong in the case of polymorphism?.
To me, it seems that inheritance and polymorphism are the same concept since both relies on the parent class to provide variables and methods to the sub class. The concept of inheritance is to promote re usability of code
since we would not need to write the same code for all the classes. So why is polymorphism necessary since it is the same as inheritance?.