标题:什么叫做在重载函数在publication中找不到?
取消只看楼主
钟SX
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-3-28
结帖率:100%
已结贴  问题点数:20 回复次数:3 
什么叫做在重载函数在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;
    }
}
搜索更多相关主题的帖子: void private include public 
2013-03-29 21:52
钟SX
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-3-28
得分:0 
回复 2楼 yctchxf
我不晓得该怎么改额。。。
2013-03-29 22:00
钟SX
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-3-28
得分:0 
回复 6楼 TonyDeng
这个代码是我自己写的。。。我不知道怎么修改而已。。
2013-03-29 22:23
钟SX
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-3-28
得分:0 
回复 9楼 shmilyflf
嗯嗯,谢谢你,是我太粗心了~
2013-03-30 21:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-402302-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056633 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved