#include <vector>
using namespace std ;
class CVX_Obj
{
public:
CVX_Obj(){};
~CVX_Obj(){};
void printobj()
{
cout<<"进入Obj"<<endl ;
}
};
class CVX_Environment
{
public:
CVX_Environment(){};
~CVX_Environment(){};
void printEnvironment()
{
cout<<"进入Env"<<endl ;
}
CVX_Obj*pObj;//初始化指针
};
class CVX_FEA
{
public:
CVX_FEA()
{
pEnv->printEnvironment();
}
~CVX_FEA(){};
CVX_Environment* pEnv;//初始化指针
};
class VoxCad
{
public:
VoxCad()
{
MainFEA.pEnv=&MainEnvironment;
MainEnvironment.pObj=&MainObj;
}
~VoxCad(){};
CVX_FEA MainFEA;
CVX_Obj MainObj;
CVX_Environment MainEnvironment;
void printt()
{
cout<<"进入VoxCad"<<endl ;
MainFEA.pEnv->pObj->printobj();
MainFEA.PRT();
}
};
int main()
{
VoxCad voxcad;
voxcad.printt();
system("pause");
}
C++ 中类之间通过指针访问
最新推荐文章于 2024-01-28 13:02:50 发布