Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Pure virtual call
Language: C/C++
Code:
#include <iostream>
using namespace std;

class A 
{

     public:
          A()
          {
               init();
               //f1();
          }
          void init(){f1();}
          virtual void f1()=0;
};

class B : public A
{
     public:
     virtual void f1()
     {
          cout << "B::f1n";
     }
};

int main() {
     // your code goes here
     B b;
     return 0;
}
          
          
Comments: