class List{
public:
int item;
int pos;
List* nextNode;
//destructor
~List(){
if(nextNode!=NULL){
delete nextNode;
}
}
List()
{
this->pos=0;
}
List(int pos)
{
nextNode=NULL;
this->pos=pos;
}
List(int item,int pos)
{
nextNode=NULL;
this->item=item;
this->pos=pos;
}
List(List &list)
{
nextNode=NULL;
this->item=list.item;
this->pos=list.pos;
this->nextNode=list.nextNode;
}
};
Comments
Leave a comment