2020
10-08
10-08
C++多重继承及多态性原理实例详解
一、多重继承的二义性问题举例:#include<iostream>usingnamespacestd;classBaseA{public:voidfun(){cout<<"A.fun"<<endl;}};classBaseB{public:voidfun(){cout<<"B.fun"<<endl;}voidtun(){cout<<"B.tun"<<endl;}};classDerived:publicBaseA,publicBaseB{public:voidtun(){cout<<"D.tun"<<endl;}voidhun(){fun();}//此处调用出现二义性,编译无法通过};intmain(){Derive...
继续阅读 >