very confused about what happens when we reinitialize the object in c++
问题 #include<iostream> #include<string.h> using namespace std; struct integer { int a; integer *next; integer *prev; }; integer *temp,*temp1,*temp2; class Myinteger { private: public: integer *head; int length; integer *tail; Myinteger() { cout<<"constructed started"<<"\n"; length=1; temp = new integer; head=temp; tail=temp; temp->prev=NULL; temp->next=NULL; temp->a=0; cout<<"constructed ended"<<"\n"; } Myinteger (string s) { cout<<"constructor started string "<<"\n"; int i=0,flag=0; temp=new