posted @ 2011-10-26 22:59
applesun0757
阅读(365)
推荐(0)
posted @ 2011-10-18 19:10
applesun0757
阅读(114)
推荐(0)
摘要:
#include #include #include using namespace std; class A{ char k[3];public: virtual void aa(){};}; class B:public A{ char j[3];public: virtual void bb(){};}; class C:public B{ char i[3];public:...
阅读全文
posted @ 2011-10-18 19:05
applesun0757
阅读(114)
推荐(0)
摘要:
【转】 http://topic.csdn.net/u/20091202/15/817018d4-e0fc-4229-94b7-0869c9366a53.html 经常听见有人说vector内存是不可以释放的。实际上这是一种误解,下面提供两种方法,各有千秋: C/C++ code int a[10] = {12,3,45,6,7,2,45,5,2,10}; vector S(a,a...
阅读全文
posted @ 2011-10-17 22:30
applesun0757
阅读(277)
推荐(0)
摘要:
class A{public: A():m(0){ //常量必须在构造函数的初始化列表中 } const int m; //常量变量 private: static int m_val; static const int m_val1 = 0; //静态常量 static const}; int A::m_val = 0; //静态变量初始化, 这里 m_val 虽然为private...
阅读全文
posted @ 2011-10-17 22:20
applesun0757
阅读(115)
推荐(0)
摘要:
【转】 http://baike.baidu.com/view/3750123.htm C++中的 虚函数 的实现一般是通过虚函数表(C++规范并没有规定具体用哪种方法,但大部分的编译器厂商都选择此方法)。 类的虚函数表是一块连续的内存,每个内存单元中记录一个JMP指令的地址。 注意的是,编译器会为每个有虚函数的类创建一个虚函数表,该虚函数表将被该类的所有对象共享。...
阅读全文
posted @ 2011-10-17 20:52
applesun0757
阅读(149)
推荐(0)
摘要:
#include class A{public: virtual void foo(){ printf("A foo\n"); } void g(){ printf("A g\n"); }}; class B:public A{public: virtual void foo(){ printf("B foo\n"); } void g(){ printf("B g\n")...
阅读全文
posted @ 2011-10-17 20:30
applesun0757
阅读(115)
推荐(0)
摘要:
【转】http://www.cnblogs.com/chio/archive/2007/10/20/931043.html 题目如下:问下列代码的打印结果为0吗?#include #include using namespace std;struct CLS{ int m_i; CLS( int i ) : m_i(i){} CLS() { CLS(0); ...
阅读全文
posted @ 2011-10-17 20:23
applesun0757
阅读(158)
推荐(0)
posted @ 2011-10-17 19:58
applesun0757
阅读(79)
推荐(0)
posted @ 2011-10-12 10:27
applesun0757
阅读(228)
推荐(0)