helle everyone
im beginner in c++ ,im learning template can you help me i cant found the error in this program
// file Tableau.h
template<class Tdonnee>
class Tableau {
Tdonnee* tab;
int taille;
public:
Tableau(Tdonnee init ,int size);
.....
//file Tableau.cpp
template<class Tdonnee> Tableau<Tdonnee> ::Tableau( Tdonnee init,int size) {
tab = new Tdonnee[size];
taille = size;
for(int i = 0 ; i<size ; i++)
{
tab = init ;
}
}
//main.cpp
int main()
{
Tableau<int> t(0,5);
return 0;}
im beginner in c++ ,im learning template can you help me i cant found the error in this program
// file Tableau.h
template<class Tdonnee>
class Tableau {
Tdonnee* tab;
int taille;
public:
Tableau(Tdonnee init ,int size);
.....
//file Tableau.cpp
template<class Tdonnee> Tableau<Tdonnee> ::Tableau( Tdonnee init,int size) {
tab = new Tdonnee[size];
taille = size;
for(int i = 0 ; i<size ; i++)
{
tab = init ;
}
}
//main.cpp
int main()
{
Tableau<int> t(0,5);
return 0;}