void readData(ifstream& file, char& operation,
int& numOfData)
// Purpose: To read data from a file specified by the user
{
file>>operation>>numOfData;
if(operation == 'I')
{
Array<int>* array;
array = new Array<int>(numOfData);
}
}
That's where the problem is coming from.
const int DEFAULT_SIZE = 30;
template <class ItemType>
class Array
{
private:
ItemType *data;
int size;
public:
Array(int size = DEFAULT_SIZE);
Array(const Array &);
~Array();
ItemType& operator[](int);
int getSize();
void operator=(const Array<ItemType> &);
}; // class Array
That's my header.
template <class ItemType>
Array<ItemType>::Array(int size)
// purpose: allocate a dynamic array using the size passed to the
// constructor.
// preconditions: size is positive.
// postconditions: a dynamic array is allocated based on the size and
// the instance variable size is set to the size of the array.
{
data = new ItemType[size];
this -> size = size;
} // set value constructor
And that's the constructor
For some reason I get an undefined ref error when I'm using the exact same thing my professor gave us except I changed it from passing long to passing int as a data type and it complied his but not mine.