Inheritance and polymorphism are both concepts and techniques in object-oriented programming. Inheritance and polymorphism are two of the features commonly used as programming techniques along with other features such as data abstraction, encapsulation, messaging, and modularity.
Polymorphism literally means “having multiple forms” in Greek. It is the ability to assign other meanings or usages that can be used in other contexts. Hence, polymorphism is the ability to create a new form out of an existing form that can be used for other cases. Polymorphism is often used to entities such as variables, function, and objects. In the case of a variable for example, a ‘polymorphic’ variable named USERNAME can be either an integer or string of characters. The programmer gives a way for it to be able to distinguish what form can be used in a specific situation or scenario (Ulsh, 2010).
On the other hand, inheritance is a concept in object oriented programming that provides a way for objects in a program to define their relationships with each other. Generally, it is the ability of the object to inherit characteristics from other object. In other words, it the ability to pass an object’s existing behavior or state to other objects that can be referred as children. As an example, a class of ‘Human’ can be considered as a general class that can represent most characteristics that we want to create. This includes the legs, arms, eyes, etc. This class is useful in creating an overall sense of all the objects.
Nevertheless, it is still limited in the sense that it cannot fulfill some specific characteristics. For example, it cannot provide a distinction between a human that has a female organ and a human that has a male organ. In this case, new class is created – man and woman. Using the virtue of inheritance, this new class (as long as they have inheritance relationship with human class) will have the characteristics that they have acquired from their parent class (i.e. humans). There is no need to create or program most characteristics for a newly created class. Of course, the characteristics that are only exclusive to the new class will not be inherited by the other class on its level (Leahy, 2011).
To define that these two concepts or approaches are completely different is tricky, since it is oftentimes difficult to argue that the relationship between a parent class and a subclass are exclusively different. However, the difference can be seen if you want to create an entirely new class but still want to borrow other characteristics or attribute from another class instead of starting from scratch. This is inheritance. Polymorphism will be emphasized if you already created a subclass but you still want to use or inject other characteristics that are unique to that class, creating a unique version of the class.
Ulsh, Jack. (2010). Polymorphism: Definition. Retrieved February 10, 2011 from http://searchcio-midmarket.techtarget.com/sDefinition/0,sid183_gci212803,00.html
Leahy, Paul. (2011) What is inheritance. Retrieved February 10, 2011 from http://java.about.com/od/objectorientedprogramming/a/inheritance.htm