I need to create an array of class template in C++ but compiler doesn't allow it. Example :
class CRefBase {
public:
virtual ~CRefBase() = 0;
};
template<class T>
class CRef : public CRefBase {
private:
T *Obj;
public:
CRef(T *Obj){ this->Obj=Obj; }
}
in main function
CRefBase *refs;
refs=new CRefBase[200]; // Error in this line : cannot allocate an object of abstract type ‘CRefBase’
I see this topic but this isn't my answer.
Thanks