differences between heritance and inheritance IN computer subject
Answers
Answered by
0
Explanation:
Comparison of Inheritance in C++ and Java
The purpose of inheritance is same in C++ and Java. Inheritance is used in both languages for reusing code and/or creating is-a relationship. There are following differences in the way both languages provide support for inheritance.
1) In Java, all classes inherit from the Object class directly or indirectly. Therefore, there is always a single inheritance tree of classes in Java, and Object class is root of the tree. In Java, if we create a class that doesn’t inherit from any class then it automatically inherits from Object class . In C++, there is forest of classes; when we create a class that doesn’t inherit from anything, we create a new tree in forest.
Similar questions