제목 : 20.4. 예제. 부모와 자식간의 메서드명 동일화 : 상속_가상함수.cpp
    
    
        
            
                | 
                    글번호:
                 | 
                
                 | 
                
                    164
                 | 
            
            
                | 
                    작성자:
                 | 
                
                 | 
                
                    
                        레드플러스
                        
                        
                    
                 | 
            
            
                | 
                    작성일:
                 | 
                
                 | 
                
                    
                        2005/08/18 오후 11:58:58 
                    
                 | 
            
            
            
                | 
                    조회수:
                 | 
                
                 | 
                
                    
                        4791
                    
                 | 
            
            
        
     
 
    
	
	
    
	#include <iostream.h>
class Parent
{
private:    //필드는 무조건 private
    int i;
public:
    Parent()
    {
        i = 100;
    }
    virtual int GetField()
    {
        return i;
    }
};
class Child : public Parent
{
public:
    int GetField()
    {
        return Parent::GetField();    //부모의 메서드 사용.
    }
};
void main()
{
    Child child;
    cout << "i = " << child.GetField() << endl;;
}