标题:看书上的看懂了总写不好。
取消只看楼主
lyj23
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:168
专家分:140
注 册:2010-10-31
结帖率:86.21%
已结贴  问题点数:0 回复次数:0 
看书上的看懂了总写不好。
程序代码:
#include <string>
#include <iostream>

using namespace std;
class And
{

 public:
        void display();
        And(int num,float sc,string nam)
        {
         number=num;
         score=sc;
         name=nam;
        }

 protected:
  int number;
  float score;
  string name;     
};
void And::display()
{

 cout<<"number:"<<number<<endl;

 cout<<"name:"<<name<<endl;

 cout<<"score:"<<score<<endl;
}
class And_1:public:And
{

 public:
        void show();
        And_1(int num,float sc,string nam,int 

sequenc):And(num,sc,nam)
        {sequence=sequenc;}

 protected:

 int sequence;
};
void And_1::show()
{

 And::display();

 cout<<"sequence:"<<sequence<<endl;
}
int main()
{

 And_1 c1(10010,95.7,"Wang-Ling",07);

 c1.show();
}
为什么通不过编译?
搜索更多相关主题的帖子: display number 
2011-04-30 11:45



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




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

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