公有多重继承问题 诚心求解 真心谢谢!!!
#include <iostream>#include <string >
using std::string ;
//abstr_emp
class abstr_emp
{
private:
string fname;
string lname;
string jop;
public:
abstr_emp();
abstr_emp(const string & fn,const string & ln,const string & j):fname(fn),lname(ln),jop(j){}
virtual void show() const;
virtual void setall() ;
virtual ~abstr_emp()=0 {}
friend std::ostream & operator<<(std::ostream & os ,const abstr_emp & e);
};
//employee
class employee:public abstr_emp
{
public:
employee();
employee(const string & fn,const string & ln,const string & j):abstr_emp(fn,ln,j){}
employee(const abstr_emp & e):abstr_emp(e){}
virtual void show()const;
virtual void setall();
};
class manege : virtual public abstr_emp
{
private:
int inchargeof;
protected:
int chargeof()const {return inchargeof;}
int & chargeof(){return inchargeof;}
public:
manege();
manege(const string & fn,const string & ln,const string & j,int a ):abstr_emp(fn,ln,j),inchargeof(a){}
manege(const abstr_emp & e,int a ):abstr_emp(e),inchargeof(a){}
manege(const abstr_emp & e):abstr_emp(e),inchargeof(0){}
virtual void show()const;
virtual void setall();
};
// fink
class fink : virtual public abstr_emp
{
private:
string reportsto;
protected:
const string report()const{return reportsto;}
string & report(){return reportsto;}
public:
fink();
fink(const string & fn,const string & ln,const string & j,string str ):abstr_emp(fn,ln,j),reportsto(str){}
fink(const abstr_emp & e ,string str):abstr_emp(e),reportsto(str){}
fink(const abstr_emp & e):abstr_emp(e),reportsto(){}
virtual void show() const;
virtual void setall() ;
};
//hingfink
class hingfink : public manege , public fink
{
};
问题:当我创建最后一个类hingfink的时候,为什么提示:虚拟函数 函数 "abstr_emp::show" 的重写不明确 ??用Vs2010 编写的时候,错误就在hingfink下面。