Original Post
ok this came up with one of my colleagues code today.
we have class CA and class CB
class CB requires a reference to a CA object in it's constructor
so
all fine and good. until we have class CC which aggreates CA and CB.
so my question is: can b_object be constructed with a reference to a_object i.e.
it seems to work, but is it standard or some weird behaviour of the msvc.net compiler.
edit: Obviously lang is C++ and yes, I know it's bad design, I'd just like to know if it'll work.
Cheers
"That's not a bug, it's a feature!"
--me
[edited by - ChaosEngine on May 14, 2003 4:15:46 AM]
[edited by - ChaosEngine on May 14, 2003 4:16:37 AM]
class CA
{
CA() {};
// nothing special
};
class CB
{
CB(CA& a)
: m_aref(a){};
CA& m_aref;
}
class CC
{
CC();
private:
CA a_object;
CB b_object;
};
CC::CC()
: b_object(a_object)
{
}