#include <iostream>
#include<string>
using namespace std;
class Student
{
public:
Student(int n, string nam )
{num=n;name=nam;}
void display()
{cout<<"num:"<<num<<endl;
cout<<"name:"<<name<<endl;
}
_____________
int num;
string name;
};
_____________
{
public:
Student1(int n,char nam[10],int a):Student(n,nam)
{age=a; }
void show( )
{display();
cout<<"age: "<<age<<endl;
}
private:
int age;
};
class Student2:public Student1
{
public:
Student2(int n, char nam[10],int a,int s):Student1(n,nam,a){score=s;}
void show_all()
{
show();
cout<<"score:"<<score<<endl;
}
private:
_____________
};
int main( )
{
int no,age,score;char name[10];
while(cin>>no>>name>>age>>score)
{
Student2 stud(no,name,age,score);
stud.show_all( );
}
return 0;
}
代码中的空白处该填什么,看了好一会儿心里依然有点模糊
onemoo
rookie_cainiao3830141
aa543187001
相关分类