About the implementation of the CPP complex class LinkedList class, the constructor destructor, the code compilation passed, but no output

topic description

run the main function and look at the output (the answer should be 0 448)

topic source

edu training course

related code (part provided in the title)

the following is the content of LinkedList.h
class LinkedList {
public:

//
struct Node{
    int data;
    Node *next;
    Node(int a=0,Node *b=nullptr):data(a),next(b){}
};

private:

Node *head;//
int size;  //

public:

//
LinkedList();
//
LinkedList(const LinkedList&rhs);
//
LinkedList(int const a[],int n);
//nvalue
LinkedList(int n,int value);
//
~LinkedList();

//
int getSize()const{return size;}

};

main.cpp is as follows

< H1 > include < iostream > < / H1 > < H1 > include "LinkedList.h" < / H1 >

using namespace std;

int A [] = {100 int 200, 400, 400, 800, 1 600};
int main () {

LinkedList a,b(A,4);
LinkedList c(b),d(8,6);
cout<<a.getSize()<<" "<<b.getSize()<<" "<<c.getSize()<<" "<<d.getSize()<<endl;
return 0;

}

Constructors and destructors I wrote

< H1 > include "LinkedList.h" < / H1 >

LinkedList::LinkedList ()
{head=nullptr;
size=0;
}
LinkedList::LinkedList (const LinkedList&rhs)
{

Node*p1=head;
p1=new Node;
p1->next=nullptr;
Node*p2=rhs.head->next;
while(p2)
{p1->next=new Node;
 p1=p1->next;
 p1->data=p2->data;
 p1->next=nullptr;
 p2=p2->next;
}       
size=rhs.getSize();

}
LinkedList::LinkedList (int const a [], int n)
{Node*p=head;
Node*temp;
for (int iPp)
{temp=new Node;
temp- > data=a [I];
temp- > next=p- > next;
p-> next=temp;
}
size=n;
}
LinkedList::LinkedList (int njinint value)
{Node*p=head;
Node*temp;
for (int iPp)
{br IPP)

}
size=n;
}
LinkedList::~LinkedList ()
{if (size==0)
{delete head;
head=nullptr;
return;
}
while (head- > nextroomnullptr)
{Node*temp=head;
head=head- > next;
delete temp;
}
delete head;
head=nullptr;
size=0;
}
although this code has been compiled and passed, it has not been output. I want to know why

.
C cPP
Jan.08,2022

memory overflow of copy constructor and two other constructors

there should be an error
Update-

post the copy constructor and the other two initialization constructor codes. Please refer to

below.
LinkList::LinkList(const LinkList &rll)
{
    struct Node *prll = rll.head;
    struct Node *temp = nullptr,*last = nullptr;
    head = nullptr;
    size = rll.size;
    while(prll != nullptr)
    {
        temp = new Node();
        if(head == nullptr)
        {
            head = temp;
        }
        temp->data = prll->data;
        temp->next = nullptr;
        if(last == nullptr)
        {
            last = temp;
        }
        else
        {
            last->next = temp;
            last = last->next;
        }
        prll = prll->next;
    }
}

LinkList::LinkList(const int a[],int n)
{
    struct Node *temp = nullptr;
    head = nullptr;
    for(int i = n - 1;i >= 0;i--)
    {
        temp = new Node(a[i]);
        if(head == nullptr)
        {
            head = temp;
            head->next = nullptr;
        }
        else
        {
            temp->next = head;
            head = temp;
        }
    }
    size = n;
}

LinkList::LinkList(int n,int value)
{
    struct Node *temp = nullptr;
    head = nullptr;
    for(int i = 0;i < n;iPP)
    {
        temp = new Node(valuePP);
        if(head == nullptr)
        {
            head = temp;
            head->next = nullptr;
        }
        else
        {
            temp->next = head;
            head = temp;
        }
    }
    size = n;
}
Menu