I have this very weird error in the constructor of my class.
#include "ContratException.h"
//#include "File.h"
namespace labPileFile {
template<typename T>
File<T>::File(const int max) :
m_tete(0), m_queue(0), m_tailleMax(max), m_cardinalite(0) {
m_tab = new T[m_tailleMax];
}
template<typename U>
std::ostream& operator <<(std::ostream& p_out, const File<U>& p_source) {
p_out << "[";
for (int i = 0; i < p_source.taille(); ++i) {
p_out << p_source[i] << ",";
}
p_out << "]";
return p_out;
}
}
Eclipse gives me several "Expression cannot be used as a function" errors
All three errors are the same thing.
here is my .h, if it can help (I have to create the .cpp from the .h that I was given)
#ifndef _FILE_H
#define _FILE_H
#include <iostream>
#include <stdexcept>
namespace labPileFile {
template<typename T>
class File {
public:
File(const int = MAX_FILE);
~File();
File(const File<T> &);
const File<T> & operator =(const File<T> &);
void enfiler(const T &);
T defiler();
int taille() const;
bool estVide() const;
bool estPleine() const;
const T & premier() const;
const T & dernier() const;
T operator [](const int &) const;
void verifieInvariant() const;
private:
T *m_tab; /*!< Content of the queue*/
int m_tete; /*!< Head of the queue (first index)*/
int m_queue; /*!< Last index of the queue*/
int m_tailleMax; /*!< Current capacity of the queue*/
int m_cardinalite; /*!< Number of elements*/
static const int MAX_FILE = 100; /*!< Default capacity*/
};
}
#include "File.hpp"
#endif
Does anyone know what I'm doing wrong?