我有疑问:如何在Visual C++ 2010中关闭突出显示关键字"事件"?我不使用.net,所以对我来说它不是关键字,我称之为变量"event".
我想问一下,当我使用没有指针的虚函数时会发生什么?例如:
#include <iostream>
using namespace std;
class Parent
{
public:
Parent(int i) { }
virtual void f() { cout<<"Parent"<<endl; }
};
class Child : public Parent
{
public:
Child(int i) : Parent(i) { }
virtual void f() { Parent::f(); cout<<" Child"<<endl; }
};
int main()
{
Parent a(2);
Parent b = Child(2);
a.f();
b.f();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
^^为什么不起作用?我在哪里可以找到有关虚拟方法如何工作的内容?