#include <iostream>
using namespace std;
class A {
public:
A() {
cout << "A Constructor" << endl;
}
~A() {
cout << "A Cestructor" << endl;
}
};
class B : public A {
public:
B() {
cout << "B Constructor" << endl;
}
~B() {
cout << "B Cestructor" << endl;
}
};
int main() {
B f;
cout << endl;
return 0;
}
執行結果:
A Constructor
B Constructor
B Cestructor
A Cestructor
沒有留言:
張貼留言