单选题

Choose the correct output of followin...

发布于 2022-03-03 17:30:34

Choose the correct output of following code:
#include <iostream>
using namespace std

class Object{
    void* data
    const int size
    const char id
public:
    Object(int sz, char c) : size(sz), id(c){
         data = new char[size]
         cout << "Constructor called for object " << id << ", size = " << size << endl
    }
    ~Object(){
        cout << "Destructor called for object " << id << endl
        delete []data
    }
}

int main() {
    Object* a = new Object(20, 'a')
    delete a
    void* b = new Object(20, 'b')
    delete b
}


登录后免费查看答案
关注者
0
被浏览
11
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看