摘要: 中提到的临时变量:见10.4.10节其中有这样一个例子:void f(string& s1,string& s2,string& s3){ const char* cs = (s1+s2).c_str(); cout<<cs; if( strlen(cs=(s2+s3).c_str())<8 && cs[0] == 'a'){ //cs used here }} 刚开始还以为没什么错误,后来经过测试发现,cs中的内容是不确定的。主要是因为(s1+s2)生成的临时变量在其所在语句执行完毕... 阅读全文
posted @ 2014-01-23 10:17 熠熠生辉 阅读(580) 评论(0) 推荐(0)
摘要: 在看Think in java的时候,发现一个很有趣的例子: 1 public class RoundGlyph extends Glyph{ 2 3 public static void main(String[] args) { 4 // TODO Auto-generated method stub 5 new RoundGlyph(3); 6 } 7 int radius = 1; 8 RoundGlyph(int r){ 9 radius = r;10 System.out.printl... 阅读全文
posted @ 2013-09-24 11:21 熠熠生辉 阅读(260) 评论(0) 推荐(0)