我知道有很多关于这个的帖子,但我仍然无法弄清楚为什么它不起作用 =/
这一行:
test = new Test2<Test>;
给我返回了这个错误:
error C2512: 'Test2<PARENT>' : no appropriate default constructor available
with
[
PARENT=Test
]
代码:
template<class PARENT>
class Test2;
////////////////////////////
class Test
{
public:
Test2<Test> *test;
Test()
{
test = new Test2<Test>;
}
};
/////////////////////////////
template<class PARENT>
class Test2
{
public:
PARENT *parent;
};
////////////////////////////
有人能帮我吗?