undefined
#include<iostream.h>

class base{
        int i;
public:
        base();                                //기본 생성자
        base(int n);                //매개변수 생성자
        void show_i();                //멤버함수
        ~base();                        //소멸자


};
base::base()
{
        i=10;
        cout<<"base 클래스 기본생성자\n";
}
base::base(int n)
{
        i=n;
        cout<<"base 클래스 매개변수 생성자"<<endl;
}
void base::show_i()
{
        cout<<"base 의 i = "<<i<<endl;
}
base::~base()
{
        cout<<"base 의 소멸자 호출 "<<endl;
}
class child : public base
{
        int j;
public:
        child();                        //기본생성자
        child(int n);                //매개변수 생성자
        void show_j();                //멤버함수
        ~child();                        //소멸자
};
child::child()
{
        j=100;
        cout<<"child 클래스 기본생성자\n";
}
child::child(int n)
{
        j=n;
        cout<<"child 매개변수 생성자\n";
}
void child::show_j()
{
        cout<<"child 의 j = "<<j<<endl;
}
child::~child()
{
        cout<<"child 소멸자 호출"<<endl;
}
int main()
{
        child ob1;
        child ob2(20);
        ob1.show_i();
        ob2.show_i();
        ob1.show_j();
        ob2.show_j();

        
        
        return 0;
}


 


 

내가 듣고싶은 음악
내가 들려주고싶은 음악