C++ | Virtual Functions | Question 7

using namespace std;

class Base
    virtual void show() = 0;

class Derived: public Base
    void show() { cout<<"In Derived \n"; }

int main(void)
    Derived d;
    Base &br = d;
    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

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.