composition

i came across a statement "composition allows objects of one class to be created inside another class"..can plz somebody elaborate this.thnx in advance for the help
1
2
3
4
class foo
{  bar  m_bar;
...
};

Class foo contains an object of another class (bar). This is composition.
Topic archived. No new replies allowed.