PDA

View Full Version : What is generalization in c++ 2011



saneha
04-29-2011, 08:13 AM
What is generalization ?


Dear Sir

Plz elaborate Generalization and give some example.

regards

Vuhelper
04-29-2011, 08:13 AM
In OO models, some class may have common characteristics. Extract these common features into a new class and inherit original class from this new class. The concept of generalization in OOP means that an object encapsulates common state and behavior for a category of objects.
Example:
In class Student, Teacher, Doctor has the common states like Name, age, gender and common attributes like eat, walk etc. So extracting all the common characteristics in a new class e.g. Shape. And inherit Student, Teacher, and Doctor Classes from the Shape class. This is called generalization.