类学习之Use Base keyword to call method in parent class from subclass
2015-06-11 22:00
621 查看
使用基础关键字从子类调用父类方法
#include <iostream> using namespace std; class Base { public: void display(void) { cout << "This is the base class" << endl; }; }; class Derived: public Base { public: void display(void) { cout << "This is the derived class" << endl; }; }; class PP:public Base{public: void display(void){cout<<"<pre name="code" class="cpp">This is the PP class"<<endl}}int main(void){ Derived my_class; my_class.display(); my_class.Base::display();my_class.PP.display();}
相关文章推荐
- cocopods install或update 安装或更新第三方库时,报The ... target overrides the 'OTHER_LDFLAGS' build setting....
- UFLDL教程笔记及练习答案五(自编码线性解码器与处理大型图像**卷积与池化)
- Java内存模型与volatile关键字
- 链表反转的四种方法分析
- 虚拟切割缝合技术学习--VR
- 使用Gson混淆遇到的NullPointException
- [BZOJ 1083] [SCOI2005] 繁忙的都市
- LeetCode_27---Remove Element
- [case分享]Exchange 2013登陆OWA失败出现The Active Directory user wasn't found
- 【一些事晚报】一个平庸程序员自白
- Eclilpse Plugin for Velocity on Luna
- Android Eclipse 环境搭建
- Mike and Feet(CF 547B)
- 黑客帝国代码雨
- 实验五 Java网络编程及安全
- C语言中可打印字符
- Android 笔记之ScrollView
- 51CTO学院两周岁啦,贺春旸送上祝福!
- 一个小型字符串工具类MString
- KAZE 算法原理与源码分析(四)KAZE特征的性能分析与比较