diag0248.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 39 行

C
39
字号
//             B
//            /
//       A   C
//        \ /
//         D

// single level positive test of this is in overload/class05.cpp

class A { public: int a; };
class B { public: int b; };
class C : public B { public: int c; };
class D : public A, public C { public: int d; };

void f1( A ** );
void f1( B ** );

void f2( A **);
void f2( C **);

void f3( A * );
void f3( B * );

void g1( D **pd )
{
    f1( pd );	// should say can't get there from here
}

void g2( D **pd )
{
    f2( pd );	// should say can't get there form here NOT ambiguous
}


void g3( D *pd )
{
    f3( pd );	// OK
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?