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

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

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

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

#include

using namespace std;

class A

{

public:

virtual void Print(){ cout<<"A";}

};

class B:public A

{

public:

void Print(){ cout<< "B";}

};

int main()

{

A *obj;

A ob1;

obj = &ob1;

obj?>Print();

B ob2;

obj = &ob2;

obj?>Print();

}


A.

It prints: AB


B.

It prints: AA


C.

It prints: BA


D.

It prints: BB


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.