By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,779 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,779 IT Pros & Developers. It's quick & easy.

class inside templated class

P: n/a
Hi:
I have a templated class, inside of which I declared another class, as
shown below:

template <class T, int nclass array
{
class subclass
{

};

};

When I try to declare a function that uses subclass as a return value I
get an error. For example:

template <class T, int n>
array<T,n>::subclass function()
{

}

int main()
{
return 0;
}

gives the following error:
main.cpp:4: error: expected constructor, destructor, or type conversion
before 'function'

Im using g++.

Any suggestions?
Thanks

Sep 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ic****@gmail.com wrote:
Hi:
I have a templated class, inside of which I declared another class, as
shown below:

template <class T, int nclass array
{
class subclass
{

};

};

When I try to declare a function that uses subclass as a return value I
get an error. For example:

template <class T, int n>
array<T,n>::subclass function()
make that:

typename array<T,n>::subclass function()
{

}

int main()
{
return 0;
}
Best

Kai-Uwe Bux
Sep 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.