I have a header in which I declare a function. Then I create the function and try to use it but i get an error. It is by reference but I don't know why it is not working.
struct.h
#ifndef LISTSTRUC_H_
#define LISTSTRUC_H_
template <class T> struct Array{
int days;
T * M;
Array( int size ) : days(size), M(new T[size])
{
}
~Array()
{
delete[] M;
}
};
void currentDay();
template <class Expe>
void dummyData(Array<Expe> &);
#endif /* LISTSTRUC_H_ */
struct.cpp
void dummyData(Array <Expe> &A){
for(int i=0; i<31; i++){
A.M[i].Expe::setObj((i*3),(i*1),(i*6),(i*2),(i*4),(i*5));
}
}
M.cpp(Main cpp)
int main(){
//Main function of the program. no pre/ post condition.
Array <Expe> A(31); // Work space
Array <Expe> B(31); // Backup space
dummyData(&A); // error
}
ERROR:
..\M.cpp:22:14: error: no matching function for call to 'dummyData(Array<Expe>*)'