December 7th, 2008, 03:47 PM
[RESOLVED] Cannot Instantiate abstract Object?
I'm working on a project for school, and I'm getting an error that doesn't make sense to me. Here's the code where the error comes from, with the error inserted to the side:
class StackAsArray: public virtual Stack
Array<Object*> theArray; <---------- Error C2259:
Array<T> cannot instantiate abstract class
void Push(Object&) = 0;
friend class Iter;
Object is, in fact, abstract, but I'm not instantiating the object, just a pointer to it. Object is the base class from which all other classes derive from, and I want to be able to store an array of them, regardless of specific type. The above code snippet is actually the solution suggested in my textbook. What am I missing? Is there a better way?
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!