Domanda

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.

È stato utile?

Soluzione

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()
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top