多级派生情况下派生类的构造函数
来源:互联网 发布:淘宝客提现多久到账 编辑:程序博客网 时间:2024/04/28 11:39
#include<iostream>
#include<string>
using namespace std;
class Student
{
public:
Student(int n,string nam)
{
num=n;
name=nam;
}
void display()
{
cout<<"num:"<<num<<endl;
cout<<"name:"<<name<<endl;
}
~Student(){}
protected:
int num;
string name;
};
class Student1:public Student
{
public:
Student1(int n,string nam,int a):
Student(n,nam)
{
age=a;
}
void show()
{
display();
cout<<"age:"<<age<<endl;
}
~Student1(){}
private:
int age;
};
class Student2:public Student1
{
public:
Student2(int n,string nam,int a,double s):
Student1(n,nam,a)
{
score=s;
}
void show_all()
{
show();
cout<<"score:"<<score<<endl;
}
~Student2(){}
private:
double score;
};
int main()
{
Student2 stud2(2008482271,"帅哥",24,100);
stud2.show_all();
return 0;
}
- 多级派生情况下派生类的构造函数
- 多级派生情况下派生类的构造函数
- 【2713】 多级派生类的构造函数
- [2713]5-3 多级派生类的构造函数
- SDUTOJ 2713 5-3 多级派生类的构造函数
- sdut 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- sdut 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 2713 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- SDUT-2713 多级派生类的构造函数
- 5-3 多级派生类的构造函数
- 王德忱文集
- 远程登录桌面很慢
- C#操作Excel(创建、打开、读写、保存)几种方法的总结
- 临时表 DML 产生redo 问题说明
- 嵌入式Linux引导过程之1.1——Xloader的xloader.lds
- 多级派生情况下派生类的构造函数
- 让 nginx 支持 pathinfo
- javascript脚本封装
- 【转】 vi vim 配置文件
- 面向接口编程详解
- OGRE 1.7 地形技术相关类结构示意图
- C# 将数据导出到Execl汇总
- ProgressDialog 的应用
- glibc与uclibc的差别