在下面的代码中,我提到了类之间的关系。它们是否正确?
class D
{
public:
D(C &c) : c_(c) {
}
private:
C &c_; // D compositions C ?? Please make me correct if i am wrong.
};
class C
{
};
void function(C &c)
{
D d(c);// main composition D
}
int main()
{
C c; // main composition C
function(c);
}