Time:09-26
# include "B.h "Class A {The public; B B; Void setXXX (init n); } Class B {//optional }
CodePudding user response:
A: : setXXX (0);//?
B to B B * m_pObjB statement A: : A () {m_pObjB=new B (this); }
object initialization of B when initialized in A constructor, B to B B * m_pObjB statement A: : A () {m_pObjB=new B (this); }
Quote: refer to the sixth floor pcradio response: Initialization of B object when initialized in A constructor, B to B B * m_pObjB statement A: : A () {m_pObjB=new B (this); } In fact, Class B is a Dlg I was also B * B pointer declarations, Just not in the constructor of A new, You are emphasized in the initialization function of A new, is there any difference between with new elsewhere?
Initialization of B object when initialized in A constructor, B to B B * m_pObjB statement A: : A () {m_pObjB=new B (this); }
Page link:https//www.codepudding.com/Softwareengineering/32474.html