C++

it2022-05-05  118

 

首先看微软的Docs上的介绍:

Allows you to explicitly state that you are calling a base-class implementation for a function that you are overriding. 

允许显式地声明正在为要覆盖的函数调用基类实现。

我理解是子类调用上一个最近的基类的函数

 有编译器提供

 

// deriv_super.cpp // compile with: /c struct B1 { void mf(int) {} }; struct B2 { void mf(short) {} void mf(char) {} }; struct D : B1, B2 { void mf(short) { __super::mf(1); // Calls B1::mf(int) __super::mf('s'); // Calls B2::mf(char) } };

很明显

据说两个基类提供相同名称的函数调用时会报错,还没验证,搞完再回来

 

转载于:https://www.cnblogs.com/HY12345/p/11172434.html

相关资源:各显卡算力对照表!

最新回复(0)