D
Dave
What is the expected output of this program and why???
#include <iostream>
using namespace std;
class base
{
public:
~base() {cout << "base" << endl;}
};
class derived: public base
{
public:
~derived() {cout << "derived" << endl;}
};
int main()
{
const base &r = derived();
(void) r; // Suppress compiler warning about unused var.
}
#include <iostream>
using namespace std;
class base
{
public:
~base() {cout << "base" << endl;}
};
class derived: public base
{
public:
~derived() {cout << "derived" << endl;}
};
int main()
{
const base &r = derived();
(void) r; // Suppress compiler warning about unused var.
}