Question

HERE IS WHERE HOW I DECLARED IT IN THE PUBLIC OF "template"

void print();

HERE IS TO PRINT

template<class T>
T XArray<T>::print()
{

    for ( int i = 0; i < size; ++i)
        cout << Array[i] << " ";
    cout << "\n\n";

}

I don't know what I'm doing wrong.

Était-ce utile?

La solution

Your definition is saying that print returns a T, but your declaration says it return void. Change it to

template<class T>
void XArray<T>::print()
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top