Difference between Generalization and inheritance with suitable example. OOAD
Asked Answered
F

2

8

Studying about Generalization and inheritance making me confuse, both gives the same meaning as if something is being inherited..but cant figure out the actual difference.

Floury answered 4/12, 2016 at 16:29 Comment(1)
F
3

The generalization/specialization relationship is implemented in object-oriented programming languages with inheritance.

Some Forms of Generalization

  1. Hierarchy: In the case of hierarchy, the commonalities are organized into a tree structured form. At the root of any subtree are found all the attributes and behavior common to all of the descendents of that root.

  2. Genericity: In this case, the commonality is expressed with the aid of a parameter. Various specializations are distinguished by what they provide for the parameter. For example, using genericity it is possible to represent the common properties of a "stack" through the generalization of a "stack of anything", where "anything" represents the parameter.

  3. Polymorphism: Polymorphism captures commonality in algorithms. Polymorphism allows the nested logic (or case statement) to be collapsed to a single case in which the different object types are treated in a uniform manner.

  4. Patterns: A pattern expresses a general solution (the key components and relationships) to a commonly occurring design problem. The attributes and behavior of the individual components are only partially defined to allow the pattern to be interpreted and applied to a wide range of situations.

Fanni answered 21/3, 2017 at 11:52 Comment(1)
Read more on Generalization and inheritanceMemoirs
M
14

Generalization is the term that we use to denote abstraction of common properties into a base class in UML.

When we implement Generalization in a programming language, it is called Inheritance.

So, Generalization and Inheritance are same, the terminology just differs depending on the context where it is being used.

Malemute answered 16/1, 2017 at 20:15 Comment(0)
F
3

The generalization/specialization relationship is implemented in object-oriented programming languages with inheritance.

Some Forms of Generalization

  1. Hierarchy: In the case of hierarchy, the commonalities are organized into a tree structured form. At the root of any subtree are found all the attributes and behavior common to all of the descendents of that root.

  2. Genericity: In this case, the commonality is expressed with the aid of a parameter. Various specializations are distinguished by what they provide for the parameter. For example, using genericity it is possible to represent the common properties of a "stack" through the generalization of a "stack of anything", where "anything" represents the parameter.

  3. Polymorphism: Polymorphism captures commonality in algorithms. Polymorphism allows the nested logic (or case statement) to be collapsed to a single case in which the different object types are treated in a uniform manner.

  4. Patterns: A pattern expresses a general solution (the key components and relationships) to a commonly occurring design problem. The attributes and behavior of the individual components are only partially defined to allow the pattern to be interpreted and applied to a wide range of situations.

Fanni answered 21/3, 2017 at 11:52 Comment(1)
Read more on Generalization and inheritanceMemoirs

© 2022 - 2024 — McMap. All rights reserved.