template class, function definition problem

S

Shea Martin

What is the signature for my GetPair function supposed to look like?


template<int Z>
class Test
{
public:
struct Pair
{
int x;
int y;
};

Pair GetPair() const;

private:
Pair p;
};

template<int Z>
Test<Z>::pair Test<Z>::GetPair() const //does not compile
{
return p;
}
 
G

Gianni Mariani

Shea said:
What is the signature for my GetPair function supposed to look like? ....
template<int Z>
Test<Z>::pair Test<Z>::GetPair() const //does not compile
add 'typename' at the beginning of the above line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,977
Members
47,556
Latest member
the lucky frog

Latest Threads

Top