设为首页 加入收藏

TOP

C++基础知识-派生类、调用顺序、访问等级、函数遮蔽(二)
2019-03-05 22:08:03 】 浏览:177
Tags:基础知识 派生 调用 顺序 访问 等级 函数 遮蔽
define
__MEN__ class Men : public Human // 表示Men是Human的子类 { public: Men(); public: void samenamefunc(int,int,int,int); public: using Human::samenamefunc; // 让父类的同名函数在子类中可见,即子类可以使用父类的同名函数 }; #endif

// Men.cpp #include "Men.h" #include <iostream> Men::Men() { std::cout << "调用了Men::Men()" << std::endl; } void Men::samenamefunc(int,int,int,int) { std::cout << "调用了Men::samenamefunc(int,int,int,int)" << std::endl; }

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇洛谷P4170 [CQOI2007]涂色(区间dp) 下一篇#leetcode刷题之路15-三数之和

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目