摘要:
#include <iostream>using namespace std;class Base{public: void fm(){cout<<"base::fm()\n";} void fm(int){cout<<"base::fm(int)\n";}};class D:public Base{public: //using Base::fm; void fm(){cout<<"D::fm()\n";}};int main(){ D d; d.fm(); d.fm(1);//err 阅读全文
摘要:
#include <iostream>using namespace std;void print(){ cout<<"in the print function"<<endl;}int main(){ //使用typedef方法 typedef void (*func)(); func fun=print; fun(); //直接定义 void (*f)()=print; f(); return 0;}一般typedef使用的比较常见,在导出dll方法的时候使用的较多 阅读全文
摘要:
#include <iostream>using namespace std;class B{ public: virtual void fun(int nNoUse=0) const=0;};class D1:public B{ public: virtual void fun(int nNoUse=1) const{cout<<nNoUse<<endl;}};class D2:public B{ public: virtual void fun(int nNoUse) const{cout<<nNoUse<<endl;}};int 阅读全文