array.h:21: error: redefinition of âclass Array<DataType>â
array.h:22: error: previous definition of âclass Array<DataType>â
// THOSE ERROR HAPEND WHEN I CALL FROM THE PROGRAM USEARRAY.CPP
arra#ifndef INC_ARRAY_H
#define INC_ARRAY_H
#endif
#if _MSC_VER > 1000
#pragma once
#endif
#include <string>
using namespace std;
template <class DataType>
class Array //HERE IS THE REDEFINITIONS LINE 21
{
public:
Array( int size );
Array( const Array<DataType> & ap );
~Array( );
Array<DataType> & operator =( const Array<DataType> & right );
inline DataType & operator [ ]( int index );
void changeSize( int newSize ); // will not alter values unless newSize is smaller
// than current capacity; in this case, the values
// from 0 to newSize - 1 will not be altered
inline int length( ) const; // returns the current capacity of the array
string err( ) const; // returns error message from errorCode
private:
DataType *elements; // points to the dynamic array
int capacity;
DataType dud; // returned from operator [ ] if index error occurs
int errorCode; // contains code for error if array misuse occurs
inline void deepCopy( const Array<DataType> & original );
};
y.h:22: error: previous definition of âclass Array<DataType>â
Olove5, Why did you totally change the question and title of this topic and not just ad your new problem to the end? (or better still post a new topic for your new problem).