什么叫做在重载函数在publication中找不到?
#include<iostream.h>#include<string.h>
class Publication
{
public:
Pubication( char* name , float price , char* date , char choose );
bool borrowornot();
void nature();
void print();
private:
char* name;
float price;
char* date;
char choose;
};
Publication::Publication( char* name , float price , char* date , char choose )
{
this->name = new char [strlen(name)+1];
strcpy( this->name , name );
this->price = price;
this->date = new char[strlen(date)+1];
strcpy( this->date = date );
this->choose = choose;
}
bool Publication::borrowornot( char choose )
{
if( choose == 'Y' )
return 1;
else
return 0;
}
void Publication::print()
{
cout<<"the book's name is "<< name <<endl;
cout<<"the book's price is "<< price <<endl;
cout<<"the book's date of publication is "<< date <<endl;
if( Publication::borrowornot( char choose ) )
{
cout<<"the book has been borrowed , you can't rent it! "<<endl;
}
else
{
cout<<"the book is available , you can rent it! "<<endl;
}
}
void main()
{
char name[100];
char date[10];
float price;
char choose1;
char choose2;
cout<<" do you want to get more information?"<<endl;
cin>>choose1;
while( choose1=='Y' )
{
cout<<"what is the name of the book?"<<endl;
cin>>name;
cout<<"when did it public?"<<endl;
cin>>date;
cout<<"how much is it?"<<endl;
cin>>price;
cout<<"whether the book has been borrowed?(Y/N)"<<endl;
cin>>choose2;
Publication book( name , price , date , choose2 );
book.print();
cout<<" do you want to get more information?"<<endl;
cin>>choose1;
}
}