• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Copy Constructor on Linked List

Dear *

Let's say I have :
class Node  {int item; Node * nnext; };
class List {int size; Node * front, * rear; List * lnext };

How to create a copy constructor and an operator= overloading for CLASS List ? What's difference between both ?

Notes : Definitely a created list will have collection of nodes and every list later will be connected to another list object.

Thanks for ur code.
1 Solution
>How to create a copy constructor and an operator= overloading ?
For the Node or the List class?

>What's difference between both ?
The copy constructor constructs a new class
and initializes it, given an existing reference.

The assignment operator is no constructor.
(= It doesnt construct anything newly, but
assigns existing things as you see above)
asampadehAuthor Commented:
I study more and I understand. Thanks Rabo.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now