#include <iostream>

class A {
public:
    A() {    std::cout << "a create" << std::endl; }
    ~A()    {   std::cout << "a delete" << std::endl; }
};
class B  {
public: 
    B() {    std::cout << "b create" << std::endl; }
    ~B()    {   std::cout << "b delete" << std::endl; }
};
class C : public B {
public: 
    C() {    std::cout << "c create" << std::endl; }
    ~C()    {   std::cout << "c delete" << std::endl; }
};


int main()
{
    
    B* a;
    a = new C();
    
    delete a;
    
    return 0;
    
}
실행 결과
a create
b create
c create
b delete
a delete

기록용...


Comment



티스토리 툴바