我正在尝试编译下面的代码。
文件 Class12.h
template <class T1>
class class1
{
public:
typedef T1 Type1;
void class1Method();
};
template <class T1>
void class1<T1>::class1Method()
{
}
template <class T1, class T2>
class class2
{
public:
typedef T2 Type2;
void class2Method();
};
template <class T1, class T2>
void class2<T1,T2>::class2Method()
{
typedef typename::class2<typename class1<T1>::Type1, T2> Type3;
}
文件类.h
#include "class12.h"
template<>
class class2<int,double>
{
};
但是我收到以下错误:
g++ -g -c class.h -o class.o
In file included from class.h:1:
class12.h: In member function `void class2<T1, T2>::class2Method()':
class12.h:27: error: expected nested-name-specifier
class12.h:27: error: expected init-declarator before "Type3"
class12.h:27: error: expected `,' or `;' before "Type3"
make: *** [class.o] Error 1
有人可以帮我吗?
非常感谢您提前抽出时间。谢谢。