你以为你真的精通 C++ 吗 -- 回答下面的问题再说吧!
bgsn 2001-03-26 05:17:00 #include <stdio.h>
public class X
{
public:
X() {
foo();
bar();
}
void bar() {
foo();
}
virtual void foo() {
printf("X::foo\n");
}
};
public class Y: public X
{
public:
virtual void foo() {
printf("Y::foo\n");
}
};
void main()
{
new Y();
}
结果是什么?为什么会是这样呢?