「C++入門」newとdeleteの使い方

C++コード
class Test
{
public:
Test() m_a(0){}
Test(int a): m_a(a){}
virtual void foo(){ cout<<m_a<<endl;}
int m_a;
};
void main()
{
Test *p1 = new Test;
Test *p2 = new Test(15);
Test *p3 = new Test[25];
delete p1;
delete p2;
delete[] p3;
}

C++

Posted by arkgame