To initialize class members, you need to use initialization lists:
Inner::Inner(const std::string& m)
: message(m)
{
}
Outer::Outer(const std::string& m)
: in(m)
{
}
(Note that I passed the strings for the constlink, which is better than passing them by value. See this answer on how to pass arguments to a function.)
, .
, . , . .
Inner ( ), , , .
: : , , :
Outer::Outer(const std::string& m) : in1(m), in2(m), in3() {}
, , , . , . , :
class outer {
public:
outer(const inner& in)
: in_(in), rin_(in_)
{}
private:
inner in_;
inner& rin_;
};
, , . , , .
, BTW, . .