Weekend Special Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: scxmas70

Note! Following CPA Exam is Retired now. Please select the alternative replacement for your Exam Certification. The new exam code is CPA-21-02

CPA Exam Dumps - C++ Certified Associate Programmer

Go to page:
Question # 33

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

#include

#include

using namespace std;

class SampleClass

{

string *s;

public:

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

SampleClass(string s) { this?>s = new string(s);}

~SampleClass() { delete s;}

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

};

int main()

{

SampleClass *obj;

obj = new SampleClass("Test");

obj?>Print();

}

A.

It prints: Text

B.

It prints: Test

C.

It prints: TextTest

D.

Garbage value.

Full Access
Go to page: