What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class A {public:void Print(){ cout<<"A"; }};class B:public A {public:virtual void Print(){ cout<< "B"; }};class C:public B {public:void Print(){ cout<< "C"; }};int main(){A ob1;B ob2;C ob3;A *obj;obj = &ob1;obj?>Print();obj = &ob2;obj?>Print();obj = &ob3;obj?>Print();}
A. It prints: BBB
B. It prints: AAA
C. It prints: ABC
D. It prints: ABB
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class A {publ
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class A {publ
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!