Quiz

Let's test your understanding of the polymorphism.

1

What is the output of the following piece of code?

#include <iostream>
using namespace std;

class Base{
public:
    virtual void print() { 
      cout <<" Base Print";
    }
};
 
class Derived: public Base{
public:
    void print() {
    cout <<"Derived Print" ; 
    }
};
 
int main(){
    Base * bp;
 		Derived obj;
 
    bp = &obj;
    bp->print();
}
A)

Derived Print
Base Print

B)

Base Print

C)

Derived Print

D)

None of the above

Question 1 of 30 attempted

Get hands-on with 1200+ tech skills courses.