0

Association of two classes- many to many

how can we implement many to many association like in E-R diagrams relation in CPP

22nd Nov 2016, 5:02 PM
Vikrant Banwal
Vikrant Banwal - avatar
8 Answers
+ 1
The best way also in databases is to create third class, that includes pointer to instances of both classes.
15th Dec 2016, 11:23 AM
Martin BrezĂĄni
Martin BrezĂĄni - avatar
+ 1
Thats the most efficient way to do it. Or you can still make pointer to some array of objects if you want to. But that is not how programmers do things. Anyways, try to specify question better. Describe the purpose of your code, why you need exactly this type of solution, describe the problem better (you can use examples) + paste simple code.
15th Dec 2016, 2:16 PM
Martin BrezĂĄni
Martin BrezĂĄni - avatar
0
sorry but i dont want to create a third class and just need to associate one to other
15th Dec 2016, 2:06 PM
Vikrant Banwal
Vikrant Banwal - avatar
0
i am not implementing this in database i am implementing this in c++
15th Dec 2016, 2:17 PM
Vikrant Banwal
Vikrant Banwal - avatar
0
i have a practical subject of c ++ with UML where i need to associate one class with the other .. i successfully associated first one with the second but when i do the same in second to the first one i failed..
15th Dec 2016, 2:27 PM
Vikrant Banwal
Vikrant Banwal - avatar
0
nope
15th Dec 2016, 2:39 PM
Vikrant Banwal
Vikrant Banwal - avatar
0
simply understand class 1 class 2 if class 2 makes change in its class then class 1 algo gets affected like dpendency
15th Dec 2016, 2:45 PM
Vikrant Banwal
Vikrant Banwal - avatar
- 1
i know how things exactly work in programming languages but this task is quite different if you have studied UML association of two classes is done using reference or pointers i must say
15th Dec 2016, 2:30 PM
Vikrant Banwal
Vikrant Banwal - avatar