问题
单项选择题
有如下程序:
#include <iostream>
using namespace std;
class Base
public:
void output() cout<<1;
virtual void Print() cout<'B';
;
class Derived:public Base
public:
void output() cout<2;
void Print() cout<<'D';
;
int main()
Base *ptr=new Derived;
ptr->output();
ptr->Print();
delete ptr;
return();
程序的输出结果是
A.1B
B.1D
C.2B
D.2D
答案
参考答案:B