carray中嵌套着包含carray的复杂类,是否可以?
这是我自己定义的一个类,它需要包含很多我所需要的信息:
class structripolymesh
{
public:
structripolymesh();
~structripolymesh();
public:
CArray <gstVector,gstVector> GlobalTriPolyNormalVectorArray;
gstTriPolyMesh* pToothTriPolyMesh;
CPreviousHIPInfo* pGlobalPreviousHIPInfo;
...}
我用一个carray来存储它:
CArray <structripolymesh*,structripolymesh*> stripolymeshArray;
构造函数:
structripolymesh::structripolymesh()
{
pGlobalPreviousHIPInfo=new CPreviousHIPInfo();
pToothTriPolyMesh=new gstTriPolyMesh();
。。。
}
问题:
1.对于类里嵌套的CArray <gstVector,gstVector> GlobalTriPolyNormalVectorArray等我需要new吗?要怎么new呢?
2.我如果这样用:
pToothTriPolyMesh0=stripolymeshArray.GetAt(0)-> pToothTriPolyMesh;
pGlobalPreviousHIPInfo0=stripolymeshArray.GetAt(0)-> pGlobalPreviousHIPInfo;
可不可以呢?这样的用法有没有什么问题?因为我在编译的时候没有错,运行结果却不是我想要的~~~
3.我总觉得这样设计数据的存储方法有点问题,有没有更合适的方法呢?
4.我现在想要系统地学习mfc的话有没有什么推荐的书呢?
刚开始编程,也没有什么专业背景,非常吃力了~~~望高手们不吝赐教~~~
[解决办法]
1、如果需要就可以new啊,当然是new gstVector了,然后加到array里面。
2、这个用法看起来没什么问题,只要array里确实有内容。
3、不知道要做什么,没有建议。
4、《深入浅出MFC》