Having the definition of classes with virtual functions, what will be the output of the program?
#include <iostream>
#include <exception>
using namespace std;

class a {
public:
    virtual void f(int) { cout<<"a int"; }
    virtual void f(char*) { cout<<"a char*"; }
};

class b : public a {
public:
    virtual void f(char*) { cout<<"b char*"; }
};

int main (void) {
  b* o = new b;
  o->f(0);
  return 0;
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes