-->
当前位置:首页 > 题库 > 正文内容

程序填空题:B Fill in the blanks

Luz4年前 (2021-05-10)题库3116
Run the following program, the output is: B::f()

```c++
#include
using namespace std;
class A{
public:
@@[virtual void f()](1){ cout<<"A::f()\n"; }
};
class B:public A{
public:
void f() {cout<<"B::f()\n"; }
};
int main()
{
B b;
A &p @@[=b](1);
@@[p.](1)f();
return 0;
}
```






答案:
第1空:virtual void f()

第2空:=b

第3空:p.

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。