11.0是春哥啊

来源:互联网 发布:mac 抹掉磁盘 编辑:程序博客网 时间:2024/06/06 16:33
/*    *Copyright (c)2015,烟台大学计算机与控制工程学院    *All rights reserved.    *文件名称:score.cpp    *作    者:战九州    *完成日期:2015年5月24日    *版 本 号:v1.0    *    *问题描述:。。。。。。。。。*程序输入:。。。。。。。。。*程序输出:。。。。。。。。。   */   #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//(1){public:    Student(char* s, int g):Person(s)// (2)    {grade=g;}    void display1( ) {        display();   //  (3)        cout<<"Grade: "<<grade<<endl;    }private:    int grade;};int main( ){    Student s("春哥",19);    s.display1();       //  (4)    return 0;}

0 0
原创粉丝点击