#GOBJ608L. GESP 6级客观题|C++ 类与对象|课堂讲解

GESP 6级客观题|C++ 类与对象|课堂讲解

GESP 6级客观题|C++ 类与对象|课堂讲解

考试频率:高频。本卷共 2 题。

  1. 以下( )没有涉及 C++ 语⾔的⾯向对象特性⽀持。

    {{ select(1) }}

  • C++ 中构造⼀个 classstruct
  • C++ 中调⽤ printf 函数
  • C++ 中调⽤⽤户定义的类成员函数
  • C++ 中构造来源于同⼀基类的多个派⽣类
  1. 如下列代码所⽰的基类(base)及其派⽣类(derived),则⽣成⼀个派⽣类的对象时,只调⽤派⽣类的构造函数。
#include <iostream>
using namespace std;

class base {
public:
    base() {
        cout << "base constructor" << endl;
    }
    ~base() {
        cout << "base destructor" << endl;
    }
};

class derived : public base {
 public:
    derived() {
        cout << "derived constructor" << endl;
    }
    ~derived() {
        cout << "derived destructor" << endl;
    }
};

{{ select(2) }}

蜀ICP备2025119001号-1