Home > Software engineering >  How to call another variables defined in the class
How to call another variables defined in the class

Time:12-24

I'm in A class defines A public variable cstrings A, then I want to use in class B A, what should I do??

There is also a problem, the test program will call variables in a DLL? If can, how should do

CodePudding user response:

The class CA {
Public:
Cstrings m_stra;
}

The class CB {
Public:
//define the types of CA member variable
CA m_ca;
Public:
{int SetInfo (cstrings STR)
//use the member variable access object of public member variable m_stra
M_ca. M_stra=STR;

}

}

Int main (int arg c, char * * argv)
{
//CB type variables
CB b;
//call b member han handsome SetInfo
B.S etInfo (" 123 ");

//a member of the access object b m_ca members of the public m_stra
Printf (" b=% s ", (LPCSTR) b.m _ca. M_stra)
}

CodePudding user response:

 class CA {
Public:
Cstrings m_stra;
}

The class CB {
Public:
//define the types of CA member variable
CA m_ca;
Public:
{int SetInfo (cstrings STR)
//use the member variable access object of public member variable m_stra
M_ca. M_stra=STR;//this sentence and the sentence what mean? Can use m_stra behind to do so?

}

}
  • Related