+ 10

Is there any relationship between Polymorphism👈Abstraction💚 Inheritance💞💝 and Composition🤔🤔

3rd Jan 2018, 1:18 AM
Junth Basnet
5 Antworten
+ 9
Polymorphism occurs when there is a hierarchy of classes related to each other through inheritance. Abstraction is used when there is no meaningful definition for the method in the superclass.
3rd Jan 2018, 1:30 AM
Vukan
Vukan - avatar
+ 1
All these things are used to create more complex code. Abstraction in this context means something without any specific details of the implementation, hence a class with a pure virtual function cannot be instantiated. Composition occurs when you put some class or structure into another. Inheritance occurs when you derive a class from other and Polymorphism when you override a behavior, a method, of the base class.
2nd Jul 2018, 2:12 PM
Gabriel Quintela
Gabriel Quintela - avatar
0
those are interrelated through oops concepts... though each have their own task ...polymorphism Ellesmere to use one function act differently ...Inheritance enables us to inherit features from the base class, whereas ... abstraction leads us to focus on only essential parts
19th Jul 2018, 8:25 AM
Deeksha
Deeksha - avatar
0
Association is another fundamental relationship between classes that is informally known as “Has-A” relationship. When an object of one class is created as data member inside another class, it is called association relationship in java or simply Has-A relationship. Look at the above figure where an object of class A is created as data member inside another class B. This relationship is known as Has-A relationship. It is easy to understand and makes a stronger form of dependency. Inheritance (“Is-A”) Relationship in Java ________________________________________ Inheritance represents Is-a relationship in Java. It establishes a relationship between a more general class (known as superclass) and a more specialized class (known as subclass). In other words, Is-A relationship defines the relationship between two classes in which one class extends another class. Look at the above figure where a class B makes a relationship with class A by the keyword “extends” and can inherit data members from class A.
20th Mar 2022, 7:42 PM
Khuram Shahzad
Khuram Shahzad - avatar
- 2
Oops
14th May 2018, 6:50 AM
Jayant Mahajan
Jayant Mahajan - avatar