In this, I frequently come across these two terms: Generalization and Inheritance.
But, the difference between the 2 is not clearly mentioned anywhere.
Can anybody solve this query?
Please provide an example for the same.
Where all the mango properties defined a fruit.
But if you talk about mosambi and orange it would be an example of inheritance.Where some properties are extended you may extend the whole properties also.
ya fruit and mango is also an example of inheritance.
So you can say that every generalization example is an example of inheritance but reverse is not true.
Correct me if i am wrong..!
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 . It is used for top-down programming and we know all the attributes and things of the project before hand.
Inheritance is the process of creating a new classes from an existing class. The Pre-existing class is called base class or super class and the new class is knows as derived class or subclass.Inheritance allows the extension and reuse of existing code, without having to repeat or rewrite the code from scratch
When we create a base/super class from two or more similar type of objects by extracting their all common characteristics(attributes and behavior) and combine them, then this process is known as Generalization.
In case of Object Oriented Programming, generalization is like to sum up or rather bundle up several functions or methods to a single type or group.
Inheritance is a very useful property of OOP.
If you have declared a parent class and wrote some functions or methods in that class its accessable in that class. Now you make another class and you make it a child class of the previously written class. Now the later written class is a child of the previous class.
Now the later written class can directly use the functions or methods written in the 1st one without being written again in the 2nd class.
@Kaustubh Katdare · Mar 7, 2014
@Ankita Katdare · Jan 11, 2015
@Ankita Katdare · Jan 27, 2014