#include <iostream>
using std::endl;
using std::cout;
class Person
{
public:
void Sleep(){
cout<<"Sleep"<<endl;
}
};
class Student : public Person
{
public:
void Study(){
cout<<"Study"<<endl;
}
};
class PartTimeStd : public Student
{
public:
void Work(){
cout<<"Work"<<endl;
}
};
int main(void)
{
Person* p1=new Person;
Person* p2=new Student;
Person* p3=new PartTimeStd;
p1->Sleep();
p2->Sleep();
p3->Sleep();
return 0;
}
#include <iostream>
using std::endl;
using std::cout;
class Person
{
public:
void Sleep(){
cout<<"Sleep"<<endl;
}
};
class Student : public Person
{
public:
void Study(){
cout<<"Study"<<endl;
}
};
class PartTimeStd : public Student
{
public:
void Work(){
cout<<"Work"<<endl;
}
};
int main(void)
{
Person* p3=new PartTimeStd;
p3->Sleep();
return 0;
}
#include <iostream>
using std::endl;
using std::cout;
class AAA
{
public:
void a(){
cout<<"a"<<endl;
}
};
class BBB : public AAA
{
public:
void b(){
cout<<"b"<<endl;
}
};
class CCC : public BBB
{
public:
void c(){
cout<<"c"<<endl;
}
};
int main(void)
{
CCC* c = new C();
c->a();
c->b();
c->c();
BBB* b = c;
AAA* a = b;
b->a();
b->b();
a->a();
return 0;
}