+ 3

how to learn coding for relationship with classes in c++(such as inheritance ,compostion)?

11th Nov 2020, 11:00 PM
Subramaniam Jeyaseelan
Subramaniam Jeyaseelan - avatar
3 Antworten
+ 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.
12th Nov 2020, 6:48 PM
Mohan
Mohan - avatar
+ 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
22nd Nov 2020, 3:35 PM
Mohan
Mohan - avatar
+ 1
Thank you for your explanation. But I needed coding.
22nd Nov 2020, 3:24 PM
Subramaniam Jeyaseelan
Subramaniam Jeyaseelan - avatar