2011年7月24日

this指针和操作符重载

摘要: Sales_item.h(C++ primer 4)2009-01-01 15:20/** This file contains code from "C++ Primer, Fourth Edition", by Stanley B.* Lippman, Jose Lajoie, and Barbara E. Moo, and is covered under the* copyright and warranty notices given in that book:* * "Copyright (c) 2005 by Objectwrite, Inc., J 阅读全文

posted @ 2011-07-24 14:47 kyleada 阅读(1044) 评论(0) 推荐(0) 编辑

const 一些知识

摘要: C++ primer 上是说 “术语:const 引用是指向 const 的引用”但是接下来又有这样的例子:观察将引用绑定到不同的类型时所发生的事情,最容易理解上述行为。假如我们编写 double dval = 3.14; const int &ri = dval;编译器会把这些代码转换成如以下形式的编码: int temp = dval; const int &ri = temp; // bind ri to that temporary这里的temp并不是const对象啊,请高手解释。。不胜感激其实这种转换对理解const并没有任何用处,转换的实质只是将一个浮点型转换为一个 阅读全文

posted @ 2011-07-24 14:27 kyleada 阅读(224) 评论(0) 推荐(0) 编辑

导航