vf17.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 51 行
C
51 行
// This test checks that the virtual function foo need not be defined
// and stuff will still link.
//
// compile with -zv
// link with option vfr (virtual functions removal)
#include "fail.h"
struct root {};
struct vb : public root {
virtual int foo() = 0;
};
struct vb1 : public vb {
void memb();
};
typedef int ( root::*mpf )();
void pass( mpf )
{
}
void vb1::memb()
{
#if __WATCOM_REVISION__ >= 8
pass( (mpf)&foo );
#else
pass( (mpf)&vb1::foo );
#endif
}
struct bot : public vb1 {
int foo();
};
int bot::foo()
{
return 17;
}
int main()
{
bot B;
_PASS;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?