For example, I have two classes
class Foo;
class Bar;
class Foo {
const Bar &m_bar;
...
};
class Bar {
const Foo &m_foo;
...
};
Let foo
is object of Foo
and bar
is object of Bar
. Is there any way (normal or "hacking") to create/initialize foo
and bar
that their members m_bar
and m_foo
would referenced to each other (I mean foo.m_bar
is bar
and bar.m_foo
is 'foo')?
It is allowed to add any members to Foo
and Bar
, to add parents for them, to make they templates and so on.