Home > database >  Delete where wrong turn hand son here
Delete where wrong turn hand son here

Time:09-17

This is the thinking in the title, in the c + + is counted themselves define a class, demanded the release of an array of memory space, need not [] I want to use a pointer offset each release, but if not goozyet , could you tell me how to operate it should
Attach a complete code:
#include
using namespace std;
The class Counted {
Private:
Int id;
Static int count;
Public:
Counted () : id (count++)
{
Cout<" The constructor is called. The Object id: "& lt; }
~ Counted ()
{
Cout<" The destructor is called. The Object id: "& lt; }
};
Int Counted: : count=0;
Int main (void)
{
Counted * p=new Counted;
The delete p;
Counted * t=new Counted [5];

}
  • Related