摘要: C风格字符串等价于string 类型字符串字面值string str1("Hello!"); //ok.char *str2 = str1; //error.char *str3 = str2.c_str(); //ok. but not quite.//注意c_str()返回的数据类型是const charconst char *str4 = str2.c_str(); //ok.文章来源:http://liyuxia-life.spaces.live.com/Blog/cns!DA1B364675ACF35!232.entry 幸运草 2009-02-27 21:18 阅读全文
posted @ 2009-02-27 21:18 liyuxia713 阅读(149) 评论(0) 推荐(0)
摘要: 动态分配的数组:成员为类类型时用默认构造函数,为内置类型时不自动初始化。(同函数内部变量的自动初始化)可以采用 new type[]()由内置类型的默认值初始化,注意不能在圆括号内写入值初始化。但是当是单个对象定义时可以: new type(value) 是有效的文章来源:http://liyuxia-life.spaces.live.com/Blog/cns!DA1B364675ACF35!231.entry 幸运草 2009-02-27 21:09 发表评论 阅读全文
posted @ 2009-02-27 21:09 liyuxia713 阅读(95) 评论(0) 推荐(0)