哪里错了,求大神
#include <iostream>using namespace std;
class cCurrency
{
public:
cCurrency(float fAmerican,float fEurope);
virtual void Print_Exchange(){}
void set();
protected:
float fAmerican;
float fEurope;
};
cCurrency::cCurrency(float fAmerican,float fEurope)
{
this->fAmerican=fAmerican;
this->fEurope=fEurope;
}
class cAmerican:public cCurrency
{
public:
void Print_Exchange();
private:
float RMB;
};
class cEurope:public cCurrency
{
public:
void Print_Exchange();
private:
float RMB;
};
void cAmerican::Print_Exchange()
{
this->RMB=100*fAmerican;
cout<<this->RMB<<endl;
}
void cEurope::Print_Exchange()
{
this->RMB=100*fEurope;
cout<<this->RMB<<endl;
}
void cCurrency::set()
{
this->fAmerican=(float)6.3492;
this->fEurope=(float)7.9365;
}
int main()
{
cCurrency *pCurrency=new cCurrency(2,3);
cAmerican A1;
cEurope A2;
pCurrency=&A1;
pCurrency->set();
pCurrency->Print_Exchange();
pCurrency=&A2;
pCurrency->set();
pCurrency->Print_Exchange();
system("pause");
return 0;
}