Summer Special Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: vce65

What is the output of the program?

What is the output of the program?

#include

#include

using namespace std;

class First

{

string name;

public:

First() {

name = "Alan";

}

void setName(string n) {this?>name = n;}

void setName() {this?>name = "John";}

void Print(){

cout << name;

}

};

int main()

{

First ob1,*ob2;

ob2 = new First();

First *t;

t = &ob1;

t?>setName();

t?>Print();

t = ob2;

t?>setName("Steve");

ob2?>Print();

}

A.

It prints: JohnSteve

B.

It prints: AlanAlan

C.

It prints: AlanSteve

D.

It prints: JohnAlan

C++ Institute CPA-21-02 Summary

  • Vendor: C++ Institute
  • Product: CPA-21-02
  • Update on: Aug 2, 2025
  • Questions: 257
Price: $52.5  $149.99
Buy Now CPA-21-02 PDF + Testing Engine Pack

Payments We Accept

Your purchase with ExamsVCE is safe and fast. Your products will be available for immediate download after your payment has been received.
The ExamsVCE website is protected by 256-bit SSL from McAfee, the leader in online security.

examsvce payment method