What will be printed out as a result of the following code execution?

#include <iostream>

using namespace std;

class Base
  virtual ~Base() { cout << "Base deleted\n"; }

class Derv: public Base
  ~Derv() { cout << "Derv deleted\n"; }

int main()
  Base *pBase = new Derv;
  delete pBase;
  return 0;

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Sign Up Now
or Subscribe for future quizzes