#include<iostream>
using namespace std;
class base {
public:
base() {
cout<<"Constructing base \n";
}
virtual ~base() {
cout<<"Destructing base \n";
}
};
class derived: public base {
public:
derived() {
cout<<"Constructing derived \n";
}
~derived() {
cout<<"Destructing derived \n";
}
};
int main(void) {
derived d();
return 0;
}
为什么在这个程序中它不调用构造函数?
谁能解释一下?
…………