Thread: How to write a paragraph explain the Big 3?

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    8

    How to write a paragraph explain the Big 3?

    Hi all, I got a question. Does anyone know that how to write a paragraph explaining the “ Big 3” - destructor, copy constructor and assignment operator?
    Thanks in advance!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yes.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    88
    Yes. Start by opening a word processor. Then form complete sentences that support a main idea. Also, be sure to indent the first line.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Okay, here is why you have two answers that are rather unhelpful:

    1. You asked a "does anyone know how to" kind of question, which merits a yes/no answer. Of course, people will often understand what you mean and cut out the "does anyone know" to interpret it as a "how to" question, which admittedly is your thread title. But...

    2. You did not make any attempt to answer your own question, thus violating the homework policy.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    8
    I am not native English speaker. In my case, it is not easy to describe the big 3 well in English.
    My answer is:
    Copy constructor: when creating an object, the compiler calls the constructor automatically.
    Destructor: automatically called by the compiler when an object archieve itsclosure.
    Assignment operator: copy the right hand side into the left hand side.

    I know my answer is not complete, any body can help me?

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Write your full paragraph, and we'll tell you if we think something is incorrect or missing. Your start seems fine, but if you need to have a paragraph, then you should probably try writing a paragraph.

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    8
    Copy constructor: when creating an object, the compiler calls the copy constructor automatically and make a copy of the default constructor.*1. When an object archieve itsclosure, the compiler called Destructor automatically to make the object exit.
    Assignment operator copy the right hand side into the left hand side.

    Above is my answer. For *1, I am not sure what will the copy constructor do before teh destructor is called. Any help?

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> I am not sure what will the copy constructor do before teh destructor is called.

    What do you mean? The copy constructor, like any other constructor, just constructs the objects. The destructor will be called when that object is destroyed, regardless of which constructor was used to create it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with fstream, one variabile for write and read
    By Smjert in forum C++ Programming
    Replies: 3
    Last Post: 02-03-2009, 10:19 PM
  2. How to write a program
    By Tashfique in forum C++ Programming
    Replies: 4
    Last Post: 10-17-2008, 11:28 AM
  3. How to write documenation for a Library ?
    By jabka in forum C Programming
    Replies: 2
    Last Post: 01-07-2008, 01:01 PM
  4. C question explain please..
    By code_guru in forum C Programming
    Replies: 3
    Last Post: 11-04-2005, 02:54 AM
  5. Programming Puns
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 04:38 PM