你这程序里确实没有写出
set_contents(int in_length,char *in_contents);
set_contents(char *in_contents);
的执行代码,只是列了上声明在类里然后就不管了
set_contents(int in_length,char *in_contents);
set_contents(char *in_contents);
的执行代码,只是列了上声明在类里然后就不管了
解决方案 »
- 无成员变量的结构体长度
- 视频采集使用SDK还是DirectShow好?
- 鼠标在标题栏和关闭按钮停留一段时间,会出现提示,怎么关掉?
- 能否直接获取到调用的模态对话框中的CComboBox选择值??
- 怎么给按纽上加上 图标
- VC++6.0中的new操作符最大可以分配管理多大的内存呀?
- ***********最新版本J2SE 5.0发货了,n多的新语言特性,n多的功能升级,除了微软,几乎所有重要厂商的参与共同研制,大家有什么想法*****
- 怎么把CSrting转成数字啊!我试了很多方法了!
- 帮忙为盼:我想在WIN2K注册表里的HKEY_LOCAL_MACHINE写一“ABC”子键,接着又想检测有没有此子键,又想删除,如何做到,用到哪些
- informix数据迁移到oracle里
- 谁有bmp to gif 的源代码
- 有没有做图像三维重建的? 岸跟你交留交流!!!
main()
{
……
x.set_contents("hello,classmate."); //创建x对象的成员函数set_contents(char *in_contents); y.set_contents(11,"Borland C++"); //创建y对象的成员函数set_contents(int in_length,char *in_contents); ……
}
这个不是set_contents执行代码?
you only have the declaration of set_contentsyou can do it like this:
int set_contents(int in_length,char *in_contents){//you code}
or
int string::set_contents(int in_length,char *in_contents)
{//you code}
多谢大家的指导,问题已经解决。
改正后的代码如下:
……
int string::set_contents(int in_length,char *in_contents)
{
length=in_length;
contents=in_contents;
return(1);
}
int string::set_contents(char*in_contents)
{
contents=in_contents;
int i=0;
while (*in_contents ++ !='\0') i++;
length=i;
return(1);
}
……