#include
<
iostream
>
using namespace std;
class IntClass
... {
public:
typedef int subType;
} ;
template < typename T >
class Base
... {
public:
//typename 修饰,subType 视为一个型别
//如果不用,subType 视为一个值
typename T::subType a;
void Print()
...{
cout <<a <<endl;
}
} ;
int main()
... {
Base<IntClass> a;
a.a = 1;
a.Print();
return 0;
}
using namespace std;
class IntClass
... {
public:
typedef int subType;
} ;
template < typename T >
class Base
... {
public:
//typename 修饰,subType 视为一个型别
//如果不用,subType 视为一个值
typename T::subType a;
void Print()
...{
cout <<a <<endl;
}
} ;
int main()
... {
Base<IntClass> a;
a.a = 1;
a.Print();
return 0;
}