![]() |
#2
funyh2502014-07-03 13:23
|

#include <string.h>
#include<iostream>
using namespace std;
enum note{middleC,Csharp,Cflat};//删掉就不能通过
class instrument{
public:
void play(note) const{
cout<<"instrument::play"<<endl;
}
};
class wind:public instrument{
void play(note)const{
cout<<"wind::play"<<endl;
}
};
void tune(instrument& i){
i.play(middleC);
}
int main()
{
//wind flute;
wind(flute); //这么定义为什么能通过???
tune(flute);
system("pause");
return 0;
}
#include<iostream>
using namespace std;
enum note{middleC,Csharp,Cflat};//删掉就不能通过
class instrument{
public:
void play(note) const{
cout<<"instrument::play"<<endl;
}
};
class wind:public instrument{
void play(note)const{
cout<<"wind::play"<<endl;
}
};
void tune(instrument& i){
i.play(middleC);
}
int main()
{
//wind flute;
wind(flute); //这么定义为什么能通过???
tune(flute);
system("pause");
return 0;
}