#include <iostream>
#include <string.h>
using namespace std;
void eat(){
cout<<"具有吃的能力。"<<endl;
};
void work(){
cout<<"具有工作的能力。"<<endl;
};
class Person{
public:
Person();
~Person();
string name;
int age;
void eat();
};
Person::Person(){
cout<<"Person()"<<endl;
}
Person::~Person(){
cout<<"~Person()"<<endl;
}
class Worker:public Person{
Worker();
void work();
};
Worker::Worker(){
cout<<"Worker()"<<endl;
}
int main()
{
Worker *p=new Worker();
delete p;
p=NULL;
}
asd8532
相关分类