21
template <typename Z> Z myTemplate <Z> :: popFromVector ()
{
if (myVector.empty () == false)
return myVector.pop_back ();
return 0;
}
int main ()
{
myTemplate <int> obj;
std :: cout << obj.popFromVector();
return 0;
}
Error:
error: void value not ignored as it ought to be
AFAI can see, the return type of popFromVector is NOT void. What's the point that I am missing?
The error disappears when I comment out this call in main().