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