CSomeClass.cpp是一个名为CSomeClass的类,我想获得同一个类的多个实例,例如
pSomeClass->Somefunction() //<-- CSomeClass.cpp
pSomeClass2->Somefunction() //<-- this CSomeClass.cpp has different values to pSomeClass, how can i set this up?
或
pSomeClass.Somefunction()
pSomeClass2.Somefunction() //this being the other instance
怎么办呢?
答案 0 :(得分:2)
然后声明两个实例:
CSomeClass * pSomeClass = new CSomeClass;
CSomeClass * pSomeClass2 = new CSomeClass;