obj?
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
virtual void Print()=0;
};
class B: public A {
public:
virtual void Print() { cout<< "B"; }
};
class C: public A {
public:
virtual void Print() { cout<< "C"; }
};
int main()
{
Bob2;
Cob3;
A*obj;
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}
A . It prints: BC
B . It prints: CB
C . It prints: CC
D . It prints: BB
Answer: A
Latest CPA-21-02 Dumps Valid Version with 222 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments