Question

In: Computer Science

Give an example that explains the generalization versus specialization in object orientated context.

  1. Give an example that explains the generalization versus specialization in object orientated context.

Solutions

Expert Solution

*******************************************************************************************************************************

Explanation of Generalization versus Specialization in Object Oriented Context --

Generalization - It is the technique of extracting shared properties or characterestics from two or more classes, and combining them into a generalized super-class. Here all the sub-classes are basically types of super-class. Therefore we can conclude a subclass “is-A” super-class and is termed as “is-A relationship”.

Specialization - It states creating new sub-classes from an existing class. If seen that certain attributes or methods only apply to some of the objects of the class then a subclass can be created. In one sentence we can say that the conversion of a super class type into a sub class type is termed as specialization.

For an example -

Let's understand Dog is-a mammal, by this we understand that Dog is a specialized kind of mammal. It bears all the features of any mammal (features like - nurses with milk, has hair), but it specializes these features to the familiar characteristics of canine domesticus.

A Cat is also a mammal. So, if we go by that then we expect it to share certain features with the Dog that are generalized in Mammal, but to distinguish in those features that are specialized in Cat.

By this example we should conclude that specialization and generalization relationships are very much reciprocal and hierarchical. They tend to be reciprocal because specialization is opposite side of the coin from generalization. Henceforth, both Dog and Cat do specialize Mammal. And Mammal generalizes from Dog and Cat. This is how they are related.

********************************************************************************************************************************

Hope this clears up your concept. Thanks ! :-)


Related Solutions

Assume that the Student class is part of a generalization/specialization hierarchy, with University Person as a...
Assume that the Student class is part of a generalization/specialization hierarchy, with University Person as a general class. What attributes would Student inherit from University Person? What are attributes are unique to the Student class, which all University Persons would not have?
Answer to the following questions. 1.What is Generalization and Specialization 2. What is a Recursive Relationship...
Answer to the following questions. 1.What is Generalization and Specialization 2. What is a Recursive Relationship 3. What is the purpose of a query and What is a stored procedure 4. What is an index  
What is a SYMMETRIC versus SKEWED DISTRIBUTION, give an example?
What is a SYMMETRIC versus SKEWED DISTRIBUTION, give an example?
What is enhanced ER Model? Explain extended ER features: Specialization, Generalization and Aggregation with your clear...
What is enhanced ER Model? Explain extended ER features: Specialization, Generalization and Aggregation with your clear definitions/ideas/differences in your own words and give at least one appropriate example for each one of them.
Give an example (with applicable reasoning) that explains why developing a HACCP plan could be difficult...
Give an example (with applicable reasoning) that explains why developing a HACCP plan could be difficult or challenging. What are two TCS foods that could be affected as a result of a breakdown in HACCP? Noting the importance of HACCP, and in light of HACCP's proven effectiveness, how would you meet the challenges?
Explain what classes and objects are in object - oriented programming. Give an example of each...
Explain what classes and objects are in object - oriented programming. Give an example of each and explain how they work together in a computer program.
Give an example of a class containing attributes and operations. Instantiate (create) an object of your...
Give an example of a class containing attributes and operations. Instantiate (create) an object of your class
Give an example of when you would use structural imaging versus functional imaging. Also, give an...
Give an example of when you would use structural imaging versus functional imaging. Also, give an example of when you would be interested in directly manipulating brain activity. (Think about the different neuroimaging methods).
Describe the Erikson's stage of intimacy versus isolation and give an example of what a person...
Describe the Erikson's stage of intimacy versus isolation and give an example of what a person might go through in experiencing this stage of life.
What is overmatching versus undermatching? Give an example of overmatching and undermatching (with hypothetical proportions) that...
What is overmatching versus undermatching? Give an example of overmatching and undermatching (with hypothetical proportions) that might occur on a concurrent VI 20-sec VI 30-sec schedule (which means that you must first work out the expected proportions with these schedules).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT