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 Topic 8 Question 58 Discussion

Actual exam question for C++ Institute's CPA - C++ Certified Associate Programmer exam
Question #: 58
Topic #: 8
[All CPA - C++ Certified Associate Programmer Questions]

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();

}

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Currently there are no comments in this discussion, be the first to comment!


Save Cancel