构造函数不能是虚函数。但有时候确实需要能传递一个指向基类对象的指针,并且有已创建的派生类对象的拷贝。通常在类内部创建一个Clone()方法,并设置为虚函数。//Listing 12.11 Virtual copy constructor#include using namespace std;cla... Read More
posted @ 2014-04-28 22:38 findumars Views(2491) Comments(0) Diggs(0)
// Listing 8.9 - Demonstrates a stray pointer typedef unsigned short int USHORT; #include <iostream> int main() { USHORT * pInt = new USHORT; // 声明第一个 Read More
posted @ 2014-04-28 21:52 findumars Views(624) Comments(0) Diggs(0)
有空挨个摘录写点心得http://www.cnblogs.com/maowang1991/p/3572304.htmlhttp://www.cnblogs.com/maowang1991/p/3571483.html Read More
posted @ 2014-04-28 20:45 findumars Views(172) Comments(0) Diggs(0)
1,前言 无数次听到“我要开始学习C++!”的呐喊,无数次听到“C++太复杂了,我真的学不会”的无奈。Stan Lippman先生曾在《C++ Primer》一书中指出“C++是最为难学的高级程序设计语言之一”,人们常将“之一”去掉以表达自己对C++的敬畏。诚然,C++程序设计语言对于学习者的确... Read More
posted @ 2014-04-28 20:42 findumars Views(391) Comments(0) Diggs(0)
等有空有空补充新的信息或者自己的心得。目前没发现C和C++的两个表有什么区别。C:decocthexchdecocthexchdecocthexchdecocthexch0000NUL(null)324020(space)6410040@9614060`1101SOH(start of header... Read More
posted @ 2014-04-28 20:11 findumars Views(5012) Comments(0) Diggs(0)
不能光转贴,有空要熟悉之后,要写点心得。现在发现 . 的优先级确实很高。 C: PrecedenceOperatorDescriptionAssociativity 1 ++ -- Suffix/postfix increment and decrement Left-to-right () Fun Read More
posted @ 2014-04-28 19:51 findumars Views(1017) Comments(0) Diggs(0)
1. const修饰普通变量和指针 const修饰变量,一般有两种写法:const TYPE value;TYPE const value;这两种写法在本质上是一样的。它的含义是:const修饰的类型为TYPE的变量value是不可变的。对于一个非指针的类型TYPE,无论怎么写,都是一个含义,即va Read More
posted @ 2014-04-28 19:48 findumars Views(1510) Comments(0) Diggs(1)