The ER Model has the ability to express database entities in a hierarchical conceptual manner. It generalizes the view of entities as the hierarchy goes up, and as we go deep into the hierarchy, it gives us the specifics of each entity included.
In this system, going up is called generalization, where entities are clubbed together to reflect a more common view. For instance, along with all the students, a specific student named Mira can be generalized. The entity is a student, and then the student is a person. Where a person is a student, and that student is Mira, the reverse is called specialty.
The process of generalizing entities, where the generalized entities include the properties of all the generalized entities, is called generalization, as stated above. In generalization, based on their related characteristics, a variety of entities are brought together into one generalized entity. The pigeon, house sparrow, crow, and dove, for example, can all be generalized as birds.
The opposite of generalization is specialization. In specialization, a group of individuals, based on their features, is divided into sub-groups. For example, take the group 'Person'. A person has a name, birth date, gender, etc. In all people, human beings, these properties are normal. But in a company, depending on what role they perform in the company, people may be defined as an employee, employer, customer, or vendor.
Similarly, persons may be qualified as teachers, students, or staff in a school database, depending on what role they play as entities in school.
In order to build classes of objects in object-oriented programming, we use all the above features of ER-Model. Generally, the details of entities are hidden from the user; this approach is known as abstraction.
An important feature of generalization and specialization is inheritance. It allows the characteristics of higher-level entities to be inherited by lower-level entities.
For example, lower-level entities such as a student or teacher may inherit the attributes of a person class such as name, age , and gender.