Association of two classes- many to many | Sololearn: Learn to code for FREE!

0

Association of two classes- many to many

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

c++

11/22/2016 5:02:55 PM

Vikrant Banwal

8 Answers

New Answer

+1

The best way also in databases is to create third class, that includes pointer to instances of both classes.

+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.

0

sorry but i dont want to create a third class and just need to associate one to other

0

i am not implementing this in database i am implementing this in c++

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..

0

0

simply understand class 1 class 2 if class 2 makes change in its class then class 1 algo gets affected like dpendency

-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