But the methods for dealing with these data might well be the same. No, this would be ridiculously inefficient. All object-oriented languages provide a simple way of capturing these commonalties in a single place. That place is called a class. The class acts as a kind of template for objects of similar nature.
Polymorphism is a Greek word meaning many forms .
It is used to express the fact that the same message can be sent to many different objects and interpreted in different ways by each object. They would all respond to the same message, but they might do so in very different ways. The move operation will behave differently for a window and differently for a chess piece. Inheritance is the sharing of attributes and operations among classes on a hierarchical relationship. A class can be defined as a generalized form and then it specialized in a subclass.