Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPA-21-02 Topic 7 Question 44 Discussion

Actual exam question for C++ Institute's CPA-21-02 exam
Question #: 44
Topic #: 7
[All CPA-21-02 Questions]

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

#include

#include

using namespace std;

class First

{

string *s;

public:

First() { s = new string("Text");}

~First() { delete s;}

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

};

int main()

{

First FirstObject;

FirstObject.Print();

FirstObject.~First();

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Charisse
3 days ago
A) It prints: Text
upvoted 0 times
...

Save Cancel