摘要: 1:子类不要覆写父类的非虚函数。2:子类不要覆写从父类继承过来的默认参数3:子类与父类之间的赋值问题1:子类不要覆写父类的非虚函数。为了解释方便,先看一个简单的例子。class A{ public: A(int d):data(d){ } void print() { cout<<"A print..."<<data<<endl; } virtual void test(int i=2) { cout<<"A test..."<<i<<endl; ... 阅读全文
posted @ 2012-07-28 11:00 啊汉 阅读(2854) 评论(0) 推荐(0) 编辑