01.Bit 단기/C++

20_개체 생성과 소멸시점

chojju 2018. 4. 30. 19:19
반응형

#include <iostream>
using namespace std;
class Stu
{
public:
 Stu() { cout << "Stu()" << endl;  }
 ~Stu() { cout << "~Stu()" << endl; }
};

void foo()
{
 Stu s;
 Stu *ps = new Stu();
 delete ps;
}

void woo()
{
// Stu s[10];
 Stu *ps[10]; //?
}

int main()
{
 cout << "foo()함수 호출 전" << endl;
// foo();
 woo();
 cout << "foo()함수 호출 후" << endl;
 return 0;
}

 

반응형