• 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.
0
asampadeh
Asked:
asampadeh
1 Solution
 
RaboCommented:
>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)
0
 
asampadehAuthor Commented:
I study more and I understand. Thanks Rabo.
0

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