Using a base class called Collection, I need to implement my derived class, VariableArray. However, I keep getting the error message
undefined reference to `Collection::Collection()'
I am not certain what I need to do here. I have a constructor defined(none virtual in my base class), along with a copy constructor, and a virtual destructor. In the derived class definition file, I included the code below, but I still get the error message.
VariableArray::VariableArray():Collection()
{ }
Please any help will be appreciated.
BASE CLASS
#include <iostream>
using namespace std;
class Collection
{
public:
Collection();
Collection( const Collection & );
virtual ~Collection()=0;
virtual bool add(const int x) =0;
virtual int& remove() = 0;
virtual Collection& operator=(const Collection& rhs)=0;
virtual int& operator[](int index) =0;
virtual const int& operator[](int index)const =0;
Collection& copy();
int size_();
protected:
private:
int _size;
};
Collection
? Show us the definition of Base class. The statement you have shown is calls the Base class constructor in the initialization list. – Alok Save Apr 24 '12 at 2:39Collection()
? This is my best guess about your problem at the moment. – Alok Save Apr 24 '12 at 2:44Collection()
constructor needs a body. If it has one, the linker isn't finding it. – chris Apr 24 '12 at 2:47