#include<iostream>
using namespace std;
class Clock
{
private:
int H;
int M;
int S;
public:
Clock()
{
cout<<"Clock's Constructor Called!"<<endl;
}
~Clock()
{
cout<<"Clock's Destructor Called!"<<endl;
}
};
class AlarmClock:public Clock
{
private:
int AH;
int AM;
public:
AlarmClock()
{
cout<<"AlarmClock's Constructor Called!"<<endl;
}
~AlarmClock()
{
cout<<"AlarmClock's Destructor Called!"<<endl;
}
};
int main()
{
AlarmClock A;
return 0;
}
派生类的析构函数
最新推荐文章于 2023-08-06 18:54:06 发布