Open In App
Related Articles

C++ | Virtual Functions | Question 7

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
#include<iostream>
using namespace std;
  
class Base
{
public:
    virtual void show() = 0;
};
  
class Derived: public Base
{
public:
    void show() { cout<<"In Derived \n"; }
};
  
int main(void)
{
    Derived d;
    Base &br = d;
    br.show();
    return 0;
}

                    
(A) Compiler Error in line “Base &br = d;” (B) Empty Output (C) In Derived

Answer: (C)

Explanation: Please refer Pure Virtual Functions and Abstract Classes in C++

Quiz of this Question

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads