C++ 多重继承 函数重载 未搞清楚问题
来源:互联网 发布:淘宝卖家怎么怎么关闭 编辑:程序博客网 时间:2024/06/08 09:12
#include "stdafx.h"#include <iostream>using namespace std;class ZooAnimal { };class Bear : public ZooAnimal { };class Endangered { };class Panda : public Bear, public Endangered { };void print(const Bear&) { cout << __LINE__ << endl; }void print(const Endangered&) { cout << __LINE__ << endl; }void print(const ZooAnimal&) { cout << __LINE__ << endl; }void _tmain(int argc, _TCHAR* argv[]){ Panda ying_yang; print(ying_yang);}
vc 2010 这样编译没有问题, 运行输出 13
如果 注释掉 15行,编译出错:error C2668: “print”: 对重载函数的调用不明确
如果 把 现在的第15行 移动到 第12行,,编译出错:error C2668: “print”: 对重载函数的调用不明确
0 1
- C++ 多重继承 函数重载 未搞清楚问题
- 重载函数的继承问题
- [c++]继承覆盖与函数重载
- 继承层次中的函数重载问题
- (C++)多重继承
- C++--多重继承
- C++多重继承问题!
- 多重继承二义性问题
- 多重继承问题总结
- 关于重载,覆盖/隐藏,虚函数,纯虚函数,多重继承
- c++多重继承下虚函数的this指针问题
- 派生类构造函数和多重继承的二义性问题
- c++ 下的多重继承虚函数调用问题
- C++多重继承下的函数动态绑定问题分析
- C++:在多重继承时的指针转换问题
- C++ :多重继承的地址问题
- 搞清楚C++继承、多态、虚函数、纯虚函数
- C++-继承:多重继承 && 虚拟继承
- 错误集锦
- 没有找到mfc100.dll
- hadoop环境报failed on connection exception
- 7. Reverse Integer
- 利用JS实现的根据经纬度计算地球上两点之间的距离
- C++ 多重继承 函数重载 未搞清楚问题
- Android中onMeasure方法的理解
- UILabel,文字添加下划线,中划线
- android 获取图片
- Very Deep Convolutional Networks for Large-Scale Image Recognition(VGG模型)
- Apache HTTP Server 版本2.2文档
- iOS开发中 UITabBarController--标签控制器的使用
- iOS //获取当前屏幕显示的viewcontroller
- Service进阶