mardi 24 octobre 2017

Template Class Member Function's Return Type is its Nested Class [duplicate]

This question already has an answer here:

I am confused as to how to implement the doThis function in the following code:

template<typename Elem> class TemplateClass{
public:
    class NestedClass{
        //parameters};
public:
    NestedClass doThis();
};

When compiling with the following implementation, "error: expected constructor, destructor, or type conversion before TemplateClass" is shown.

The member function implementation I used is:

template<typename Elem> TemplateClass<Elem>::NestedClass TemplateClass<Elem>::doThis(){
//do stuff...
}

Aucun commentaire:

Enregistrer un commentaire