What will be printed out as a result of the following code execution?
#include <iostream>
using namespace std;

class a
{
public:
  static int s;
  a(){++s; cout<<s;}
  ~a(){--s;cout<<s;}
};

int a::s;

class b:public a
{
public:
  b():a(){++s;cout<<s;}
  ~b(){--s;cout<<s;}
};


int main()
{
  a *one = new b;
  delete one;
  cin.get();
}

Follow CodeGalaxy

Mobile Beta

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