摘要:
dynamic 转换时的类必须有虚函数,否则会编译报错。#include using namespace std;class A{public: int a ; int b; void prt(void){std::cout (pA); cout (rA); cou... 阅读全文
摘要:
#include using namespace std;class A{public: int a ; int b; void prt(void){std::cout prt();}因为其为静态绑定,编译时就已经制定了函数的如可地址。输出结果为:> ./a.out prt her... 阅读全文
摘要:
#include struct CloneableBase { virtual CloneableBase* clone() const = 0;};templatestruct Cloneable : CloneableBase { virtual CloneableBase* clo... 阅读全文
摘要:
http://www.cnblogs.com/zhuyf87/archive/2013/03/12/2955058.html#includeusing namespace std;class CBird{public: CBird() { cout fly(); delete pBird... 阅读全文