单选题 C++
题号 #4126087

有如下程序:
#include<iostream>
using namespace std;
class XX{
protected:
    int k;
public:
    XX(int n=5):k(n){}
    ~XX(){cout<<"XX";}
    virtual void f() const=0;
};
inline void XX::f()const {cout<<k+3;}
class YY: public XX{
public:
    ~YY(){cout<<"YY";}
    void f() const{cout <<k-3;XX::f();}
};
int main ()
{
    XX&p=*new YY;
    p.f();
    delete &p;
    return 0;
};
执行上面的程序将输出________。

进入在线模考

参考答案

A

答案解析

略。

你可能感兴趣的试题

A.8/3和8.0/3.0          
B.8/3.0和8/3
C.8.0/3和8/3            
D.8.0/3.0和8.0/3
A.一元非成员运算符       
B.一元成员运算符
C.二元非成员运算符       
D.二元成员运算符
找试题 · 找答案 · 找资料 在线模考