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

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

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

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

#include

#include

using namespace std;

class A {

public:

A() { cout << "A no parameters";}

A(string s) { cout << "A string parameter";}

A(A &a) { cout << "A object A parameter";}

};

class B : public A {

public:

B() { cout << "B no parameters";}

B(string s) { cout << "B string parameter";}

};

int main () {

A a1;

A a2("Test");

B b1("Alan");

return 0;

}


A.

It prints: A no parametersA string parameterA no parametersB string parameter


B.

It prints: A no parametersB string parameter


C.

It prints: B string parameter


D.

It prints: B no parameter


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.