是春哥啊

来源:互联网 发布:godaddy如何转入域名 编辑:程序博客网 时间:2024/05/29 17:43
/* *Copyright   (c)  2016,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者: 武聪 *完成日期:2016年5月27日 *版本号: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{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();    return 0;}


运行结果:

知识点总结:

函数的使用

学习心得:

比以前熟练了很多

0 0
原创粉丝点击