HELP ME

Discussion in 'C++' started by aman, Oct 1, 2007.

  1. aman

    aman Guest

    CAN ANYBODY TELL ME THE CONCEPT OF COPY CONSTRUCTOR IN REALLY SINMPLE
    MANNER
     
    aman, Oct 1, 2007
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Oct 1, 2007
    #2
    1. Advertising

  3. aman

    osmium Guest

    "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
     
    osmium, Oct 1, 2007
    #3
  4. On Oct 1, 11:19 pm, aman <> 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
     
    Chris ( Val ), Oct 1, 2007
    #4
  5. aman

    Mike Wahler Guest

    "aman" <> wrote in message
    news:...
    > 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
     
    Mike Wahler, Oct 2, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dHJlbGxvdzQyMg==?=

    HELP! HELP! HELP! Opening Web Application Project Error

    =?Utf-8?B?dHJlbGxvdzQyMg==?=, Feb 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    784
    =?Utf-8?B?dHJlbGxvdzQyMg==?=
    Feb 20, 2004
  2. Harvey
    Replies:
    0
    Views:
    736
    Harvey
    Jul 16, 2004
  3. Harvey
    Replies:
    1
    Views:
    868
    Daniel
    Jul 16, 2004
  4. =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=

    HELP - HELP - HELP

    =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    693
    Eliyahu Goldin
    Mar 9, 2006
  5. Buster

    Help, Help, Help

    Buster, Oct 4, 2003, in forum: Java
    Replies:
    3
    Views:
    482
    Saager
    Oct 30, 2003
Loading...

Share This Page