I’ve been encountered by the next code:
#include "superClass.h" //Nesting the class: nestedClass
template <class T>
class subClass : public superClass<T>
{
void foo(class superClass<T>::nestedClass * x);
}
It is also noted that it’s actually valid to write:
void foo(nestedClass* x);
instead, but there’re compilers which require the additional scope resolution operator.
May someone please explain to me why the scope resolution operator is required? And is it required only when using template classes?
New contributor
CS Student is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3