Papers/Others

객체생성, 소멸

tomato13 2007. 1. 19. 21:28

[tpdev@j3s3h3 ARIB_MW]$ cat test.cpp
#include <stdio.h>

class CTest{
public:
        CTest() {
                printf("constructor\n");
        };
        ~CTest() {
                printf("destructor\n");
        };

        void doTest() {
                printf("doTest\n");
        };
};

int main(void){
        CTest test;
        test.doTest();

        return 1;
}
[tpdev@j3s3h3 ARIB_MW]$ g++ -o test ./test.cpp
[tpdev@j3s3h3 ARIB_MW]$ ./test
constructor
doTest
destructor
[tpdev@j3s3h3 ARIB_MW]$