</pre><p>/* *copyright(c) 2014,烟台大学计算机学院 *All rights reserved *文件名称:test.cpp *作者:吴雨凡 *版本:v6.0 * *问题描述:是春哥啊</p><p> *输入描述: *程序输出:判断相关问题*/</p><pre class="cpp" code_snippet_id="664922" snippet_file_name="blog_20150512_1_1684696" name="code">#include <iostream>
#include <cstring>
using namespace std;
class Person{
public:
Person(char* s){
strcpy(name,s);
}
void display( ){
cout<<"Name: "<<name<<endl;
}
private:
char name [20];
};
class Student:public Person
{
public:
Student(char* s, int g):Person(s)
{grade=g;}
void display1( ) {
display();
cout<<"Grade: "<<grade<<endl;
}
private:
int grade;
};
int main( )
{
Student s("春哥",19);
s.display1(); // (4)
return 0;
}