/*
CRerference2.cpp
*/
#include <iostream>
using std::cout;
using std::endl;
class Person
{
public :
void Sleep() const
{
cout<<"Sleep"<<endl;
}
};
class Student : public Person
{
public :
void Study() const
{
cout<<"Study"<<endl;
}
};
class PartTimeStd : public Student
{
public :
void Work() const
{
cout<<"Work"<<endl;
}
};
int main(void)
{
PartTimeStd p;
p.Sleep();
p.Study();
p.Work();
Person& ref = p;
ref.Sleep();
//ref.Study();
//ref.Work();
return 0;
}
반응형
'C, C++, Java' 카테고리의 다른 글
Score cut-off C++ program (0) | 2014.09.05 |
---|---|
Overriding1.cpp (0) | 2014.05.02 |
P304.cpp (0) | 2014.05.02 |
CPointer2.cpp (0) | 2014.05.02 |
EmployeeManager3.cpp (0) | 2014.05.02 |