Chinaunix首页 | 论坛 | 博客
  • 博客访问: 628106
  • 博文数量: 603
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 4940
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-17 11:04
文章分类

全部博文(603)

文章存档

2011年(1)

2008年(602)

我的朋友

分类:

2008-09-17 11:13:19

问大侠们一个模板的问题

我定义了一个模板
templateclass String{
struct Srep;
Srep *rep;
public:
String();
String(const C*);
String(const String&);
C read(int i) const;
};

template struct String::Srep{
C* s;//到元素的指针
int sz;//元素个数
int n;

};

template String::String()
{
rep=new Srep(0,C());//**************************error
}

int main()
{
String buf;
return 0;
}
在标记的地方报如下错误
error C2514: 'String::Srep' : class has no constructors
E:\OpenCV_Test\childclass\childclass.cpp(6) : see declaration of 'Srep'
E:\OpenCV_Test\childclass\childclass.cpp(48) : while compiling class-template member function '__thiscall String::String(void)'
Error executing cl.exe.
望大侠们赐教

__________________
飘飘荡荡的尘埃


--------------------next---------------------

阅读(248) | 评论(0) | 转发(0) |
0

上一篇: 

下一篇:显示可打印版本

给主人留下些什么吧!~~