Home > Back-end >  Class c pointer call problem between members
Class c pointer call problem between members

Time:09-18

Class B;
Class C
{
Public:
Void the print ()
{
STD: : cout & lt; <"This is the c & lt;" }
};
Class A
{
Public:
A (B * B)
{
B_ptr=b;
}
Void the print ()
{
STD: : cout & lt; <"This is b" & lt; }

Public:
B * b_ptr;
};
Class B
{
Public:
(B)
{
CreatePtr ();
}
Void the print ()
{
STD: : cout & lt; <"This is a" & lt; }
Void CreatePtr ()
{
C_ptr=new C;
}
Public:
C * c_ptr;
};
Void main ()
{
B * B=new B;
A * A=new A (b);
B - & gt; Print ();
b & gt; C_ptr - & gt; Print ();
A - & gt; Print ();
a - & gt; B_ptr - & gt; C_ptr - & gt; Print ();
}

The red this way of multilayer calls a reasonable excuse me, always don't feel very well

CodePudding user response:

Syntax allows, as for shu uncomfortable, is your design problem,

CodePudding user response:

The key is you want to be a what effect? Is: what is your demand?

CodePudding user response:

Another 4 k big screen feel
  • Related