C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 25 Topic 3 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 25 Topic 3 Discussion

CPA-21-02 Exam Topic 3 Question 25 Discussion:
Question #: 25
Topic #: 3

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

#include

#include

using namespace std;

struct Person {

string name;

int age;

};

class First

{

Person *person;

public:

First() {person = new Person;

person?>name = "John";

person?>age = 30;

}

void Print(){

cout<name << " "<< person?>age;

}

};

int main()

{

First t;

t.Print();

}


A.

It prints: 30


B.

It prints: John


C.

It prints: John 30


D.

It prints: John 30John 30


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.