Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > HELP ME

Reply
Thread Tools

HELP ME

 
 
aman
Guest
Posts: n/a
 
      10-01-2007
CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
MANNER

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      10-01-2007
aman wrote:
> CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
> MANNER


Not unless you stop shouting.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      10-01-2007
"aman" writes:

> CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
> MANNER


Read the link and think of the consequences when an object has pointers and
only the "shallow copy" offered by the default copy constructor.

http://en.wikipedia.org/wiki/Copy_constructor


 
Reply With Quote
 
Chris ( Val )
Guest
Posts: n/a
 
      10-01-2007
On Oct 1, 11:19 pm, aman <(E-Mail Removed)> wrote:
> CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
> MANNER


Please do not use your CAPS LOCK when asking questions, as it
is considered as shouting and being rude.

The simple answer is, it makes copies

A class in C++ provides you with a copy ctor by default. Even
though you can't physically see it, it does exist.

The only time you need to manually implement it is for example,
if your class is is responsible for managing some memory for one
or a number of its data members.

The best way to learn about it is to experiment.

Looking up "deep copy" vs "shallow copy" should provide you with
a much better understanding of the concepts behind it.

Post back if you're still having problems understanding it, and
we'll try to clarify it further.

--
Chris Val

 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      10-02-2007

"aman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
> MANNER


[waiting for ringing in my ears (eyes?) to stop]

Constructor: Initializes a newly created object
to a known state.

Copy constructor: Initializes a newly created object
with a state equal to that of an already existing
object of the same type (i.e. it makes a copy of
an existing object).

What C++ book are you reading that doesn't explain this?
Perhaps you need a better one. See www.accu.org for
peer reviews and recommendations.

-Mike


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments