返回信息流代码编译在VC6.0上可以通过,可是运行时却总是有错,不知道什么原因,请大家看看
class CStrOne
{
public:
CStrOne(char *s)
{
string1= s;
}
const char *re()
{
return string1;
}
void showstring()
{
cout<<string1<<endl;
}
private:
const char *string1;
};
class CStrTwo : public CStrOne
{
public:
CStrTwo(char *s1, char *s2) : CStrOne(s1)
{
string2 = s2;
}
void together()
{
strcat(string2, re());
}
void show()
{
showstring();
cout<<string2<<endl;
}
private:
char *string2;
};
int main()
{
CStrTwo s("Hello,World!", "Do I know u?");
s.together();
s.show();
return 0;
}
这是一条镜像帖。来源:北邮人论坛 / cpp / #45564同步于 2010/11/3
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
求指教
THINK
2010/11/3镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。