繁体   English   中英

模板继承中的VC ++错误

[英]VC++ Error on template inheritance

这是孩子的游戏,但我有点vc n00b。

我收到一个错误: error C2143: syntax error : missing ',' before '<' 在以下代码的第二行:

template<int i, int j> 
class B : public A<i, j> { }

template<int i, int j> 
class A { }

谢谢您的帮助!

您忘记了分号和A的声明(只需在B之前声明A,以避免编写声明):

template<int i, int j> 
class A { };

template<int i, int j> 
class B : public A<i, j> { };

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM