+ 3
how to learn coding for relationship with classes in c++(such as inheritance ,compostion)?
3 Réponses
+ 3
U only need to think of the logic behind it, u can do coding by urself, if u understand the concept completely.
Explanation of Inheritance, association, composition and aggregation:
In Inheritance, the sub class inherites the properties and methods from its super class. This is a "IS - A" relationship, like for example:
Google "is - a" company.
C++ "is - a" programming language.
etc
In association, class Y has a object pointer of class X. For example, car "has" wheels.
In composition, class Y has private class X and its object inside its body, means class X should also be inside the class Y, without class Y, class X is nothing. For example, human "has" brain, here brain is inside the human, without human, there is no brain.
In Aggregation, class Y has a object pointer of class X, but here, both class X and Y can also live independently, even if class Y doesn't have object pointer of class X, class Y can still exist without any problem. For eg, car "has" passenger in it. Car dont need passenger to work.
+ 5
Jeyaseelan Seelan once u understand these concepts, making their programs isn't that hard, try to make program, if u have problem while writing it, u can ask me then
+ 1
Thank you for your explanation.
But I needed coding.