C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 76 Topic 8 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 76 Topic 8 Discussion

CPA-21-02 Exam Topic 8 Question 76 Discussion:
Question #: 76
Topic #: 8

What happens when you attempt to compile and run the following code?

#include

using namespace std;

class BaseC

{

int *ptr;

public:

BaseC() { ptr = new int(10);}

BaseC(int i) { ptr = new int(i); }

~BaseC() { delete ptr; }

void Print() { cout << *ptr; }

};

int main()

{

BaseC *o = new BaseC(5);

o?>Print();

}


A.

It prints: 5


B.

It prints: 10


C.

It prints: 1


D.

It prints: 0


Get Premium CPA-21-02 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.