C++ Question: using

看看这段代码:

#include <stdio.h>

struct A {
	void f() { printf("A::f\n"); }
};
struct B : A {
	using A::f; // #1
	void f() { printf("B::f\n"); } // #2
};

int main() {
    B().f(); #3
    return 0;
}

运行结果会如何呢?

A. B::f

B. #1 编译错

C. #2 编译错

D. #3 编译错 


posted on 2011-11-20 09:49  能发波  阅读(97)  评论(0)    收藏  举报

导航