Association C++

Dec 10, 2018 at 12:53pm
Any example Association relationship in Object Oriented c++ program?
Last edited on Dec 10, 2018 at 2:21pm
Dec 10, 2018 at 1:18pm
Please tell to the unschooled one, what is an "Association relationship"?
Dec 10, 2018 at 1:38pm
std::map is an associative container. See:

http://www.cplusplus.com/reference/map/map/?kw=map

See this for more:

http://www.cplusplus.com/reference/stl/
Dec 10, 2018 at 1:43pm
Built-in arrays map numbers 0-N to a value. N must be known at compile time.

std::vector<> maps numbers 0-N to a value. N is determined at runtime and can change during the program.

std::map<> maps an arbitrary key to a value. The only restriction on the key type is that it must support a weak ordering (i.e. you must be able to compare two keys to see if one is less than the other).

In all cases the values must be the same type.
Dec 10, 2018 at 2:35pm
I wonder if the OP means aggregation or composition relationships?

https://stackoverflow.com/help/how-to-ask

Nine words for a question doesn't cut it, IMO.
Topic archived. No new replies allowed.