64,654
社区成员
发帖
与我相关
我的任务
分享
#include <string>
#include <iostream>
int main()
{
typedef std::string MyString ;
MyString A("hello",1);
MyString B("world",2);
MyString p[2] = {A,B};
std::cout << p[0] << "," << p[1] << std::endl;
return 0;
}
//h,wo
绝对相信你的构造函数有问题。
MyString A("hello",1);
MyString B("world",2);
MyString p[2] = {A,B};
//这种方式不可以吧!,即使是内部类型结构貌似都是不可以的!
//这个不能偷懒吧,逐个赋值初始化吧