是春哥啊
2016-06-09 08:45
323 查看
问题及代码:
结果及总结:
/* *copyright(c) 2016,烟台大学计算机学院 *All rights reserved *文件名称:test.cpp *问题描述:第十一周练习,是春哥啊 *作者:杨昊 *版本:v6.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; }
结果及总结:
相关文章推荐
- 第十 十一周项目2-存储班长信息的学生类(2)
- 类和指针程序阅读(2)
- ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序
- (补)第十三周——分数的加减(运算符重载)
- 数组在类中的运算
- 第十/十一周训练 项目5
- poj 3276 Face The Right Way
- 2016山东省赛H题
- 第八周项目一数组做数据成员
- map用法祥析
- 粗浅看 JSTL标签库和EL表达式
- 2048小游戏(javascript代码)
- const导致的编译错误, 浪费了10分钟
- 第十五周项目1——程序填空(范型程序设计)
- 阅读程序(7)
- Struts2中使用POJO
- OpenCV学习Histogram&equalizeHist&Lomography effect&Cartoonize effect实现
- Climbing Stairs
- 第十四周阅读程序2
- 第十五周--阅读程序5