第五章t2
2015-06-01 22:13
281 查看
#include<iostream> #include<string> using namespace std; class Student { public: void get_value() { cin>>num>>name>>sex; } void display() { cout<<"num:"<<num<<endl; cout<<"name:"<<name<<endl; cout<<"sex:"<<sex<<endl; } private: int num; string name; char sex; }; class Student1:private Student { public: void get_value_1() { get_value(); cin>>age>>addr; } void display_1() { display(); cout<<"age:"<<age<<endl; cout<<"addr:"<<addr<<endl; } private: int age; string addr; }; int main() { Student1 stud; stud.get_value_1(); stud.display_1(); return 0; }
相关文章推荐
- 进程、线程小结(2)
- php扩展开发笔记(1)创建类的数组属性
- JSP内置对象
- Linux文件系统管理
- 手动给帮助类打 jar包 和 给Web项目打 war包
- apache 无法访问根目录下的子目录——(笔记)
- 阻止OSX休眠
- 长沙甲壳虫教育 留学
- Project Euler:Problem 23 Non-abundant sums
- 给定一个正整数数组,找所有元素组合起来最大的值(答案)
- 如何对IP地址进行排序?
- HDU 1004 Let the Balloon Rise (map使用)
- ViewConfiguration.getScaledTouchSlop () 用法
- C5.0算法学习
- Oracle之内存结构(SGA、PGA)
- 自己动手 CentOS-6.5 安装Oracle11g R2
- 堆排序
- office2010永久的密钥
- linux线程
- 第四章t7