C++/상속의 이해

상속하는 클래스의 객체생성과정 및 소멸과정

빛나는 미래 2012. 3. 22. 01:53


#include <iostream>
using namespace::std;

class AAA
{
public:
 AAA()
 {
  cout<<"AAA() 콜"<<endl;
 }
 AAA(int i)
 {
  cout<<"AAA(int) 콜"<<endl;
 }
};

class BBB : public AAA
{
public:

 BBB()
 {
  cout<<"BBB() 콜"<<endl;
 }
 BBB(int i)
 {
  cout<<"BBB(int) 콜"<<endl;
 }
};


int main()
{
 cout<<"객체 1생성"<<endl;
 BBB b1;
 cout<<"객체 2생성"<<endl;
 BBB b2(10);

 return 0;
};