Results 1 to 5 of 5

Thread: Deep Copy : C++

  1. #1
    Join Date
    Jan 2010
    Posts
    26

    Deep Copy : C++

    Hello, I am the student of the Msc-CS of first year. I have the knowledge of the C++ language. but I do not know anything about the Deep Copy. And also I have to submit the project on the Deep Copy in College. So, I want to know about the Deep Copy in C++. I also want to know about how I am able to use Deep Copy in the C++ program. If anyone has the answer on Deep Copy then reply me. I am waiting for your answer, Please!!

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Deep Copy

    Hi, I think the Deep Copy can copy all of the fields and then can makes copy of the dynamically allocating block of memory that can be pointed to by the fields. The assignment operator and the Copy Constructor can have to be overwritten, if you can want to perform the Deep Copy in C++ language. In case of the Deep Copy, data that can be copied and the original data can allocate different portions for two copies. You must have to use the Copy Constructor to perform the Deep Copy.
    Last edited by Praetor; 05-02-2010 at 04:21 PM.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Deep Copy : C++

    Hello, A Deep Copy can duplicates the variable or object that can be pointed to so that destinations own copy that is being local for it can be received by the destination. In this manner, the object and the local copy that can be copied from could not be affected even if the destination could do whatever it wants to it’s the object and the local copy. For performing the Deep Copy can requires that you have to write your own assignment operators that can be overloaded and the copy constructors.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Deep Copy

    According to my knowledge about the Deep Copy is that A class that can requires deep copies could basically need the following :
    a) To make a copy of the allocated memory that can be dynamically allocated, a copy constructor must required.
    b) To make a copy of the allocated memory that can be dynamically allocated, aAn overloaded assignment operator can be required.
    c) To delete the allocated memory that can be dynamically allocated, a destructor can be required.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Program : Deep Copy

    The following code of lines can demonstrates you about the Deep Copy. I suggest you to go through very carefully :
    Code:
    ABC::ABC(const ABC& cSrc)
    {
    mLngt = cSrc.mnLngt;
    if (cSrc.mpchStrng)
    {
    mpchStrng = new char[mnLngt];
    strncpy(mpchStrng, cSrc.mpchStrng, mnLngt);
    }
    else
    mpchStrng = 0;
    }
    I hope you should understood from the above.

Similar Threads

  1. Cannot copy <filename> path is too deep
    By AU in forum Windows Server Help
    Replies: 2
    Last Post: 18-11-2012, 01:57 PM
  2. Cannot abort deep System Scan
    By aSITA in forum Networking & Security
    Replies: 3
    Last Post: 16-02-2011, 07:21 AM
  3. Disabling Deep freeze Antivirus
    By Yaropolk in forum Networking & Security
    Replies: 4
    Last Post: 04-02-2009, 02:22 AM
  4. Deep memory
    By Mirinda in forum Motherboard Processor & RAM
    Replies: 2
    Last Post: 06-01-2009, 01:21 PM
  5. Deep Blue Programming
    By SAeLac in forum Software Development
    Replies: 1
    Last Post: 10-10-2008, 06:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,431,449.30455 seconds with 17 queries