10 11周阅读程序(2)
来源:互联网 发布:国牌lolita店铺淘宝 编辑:程序博客网 时间:2024/05/18 02:59
#include <iostream>using namespace std;class A{public: A(){a=0;} A (int i){a=i;} void print(){cout<<a<<" ";}private: int a;};class B: public A{public: B(){b=0;} B(int i, int j, int k): A(i),aa(j){b=k;} void print() //(1) { A::print(); //(2) aa.print(); //(3) cout<<b<<endl; }private: int b; A aa;};int main(){ B test[2]; test[0]=B(1,4,7); test[1]=B(2,5,8); for(int i=0; i<2; i++) test[i].print(); return 0;}结果:1 4 7 2 5 8
0 0
- 10 11周阅读程序(2)
- 10 11周阅读程序(3)
- 第11周阅读程序(2)
- 第10、11周-阅读程序(2)
- 10,11周阅读程序
- 11-阅读程序2
- 阅读程序(2)
- 程序阅读(2)
- 阅读程序(2)
- 第十六周 程序阅读(补充阅读)
- 第14周项目6-阅读程序(10,11)
- 第10、11周-阅读程序(1)
- 第10、11周-阅读程序(5)a
- 第10、11周-阅读程序(5)b
- 第10、11周-阅读程序(5)c
- 第10、11周-阅读程序(5)d
- 第10、11周-阅读程序(5)e
- 第10、11周-阅读程序(3)
- IOS Dev Intro - ARC Forbid Explicit Release
- MD5加密
- WebService到底是什么?
- Keil(MDK-ARM)系列教程(七)_菜单
- set容器
- 10 11周阅读程序(2)
- StreamUtil
- 谈一谈CMU导师和学生的互动方式
- Copying Accelerated Video Decode Frame Buffers
- 词典
- 这世界大有搞头
- 开篇之作
- 第十二周课后实践(2)
- onWindowFocusChanged重要作用