C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 77 Topic 8 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 77 Topic 8 Discussion

CPA-21-02 Exam Topic 8 Question 77 Discussion:
Question #: 77
Topic #: 8

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

#include

#include

using namespace std;

class A {

public:

string s;

A(string s) { this?>s = s; }

};

class B {

public:

string s;

B (A a) { this?>s = a.s; }

void print() { cout<

};

int main()

{

A a("Hello world");

B b=a;

b.print();

}


A.

It prints: Hello world


B.

It prints: Hello


C.

Compilation error


D.

None of these


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.