473,378 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to write a paragraph explain the Big 3?

6
Hi all, I am new here. I wonder anybody knows how to write a paragraph explaining the “ Big 3” - destructor, copy constructor and assignment operator?
Thanks in advance!
May 12 '07 #1
10 2385
AdrianH
1,251 Expert 1GB
Hi all, I am new here. I wonder anybody knows how to write a paragraph explaining the “ Big 3” - destructor, copy constructor and assignment operator?
Thanks in advance!
I'm sure that there are many here who can write a paragraph about the 'Big 3', but that is not what we do here. We help our members learn, not give them the answers.

If you write a paragraph about the 'Big 3', we can look at it and direct you accordingly.

Looking forward to hearing your paragraph.


Adrian
May 12 '07 #2
cmrcm
6
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?
May 12 '07 #3
JosAH
11,448 Expert 8TB
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?
Here are a few hints:
Expand|Select|Wrap|Line Numbers
  1. {
  2.    YourClass a; // default constructor;
  3.    ...
  4.    YourClass b= a; // copy constructor
  5.    ...
  6.    yourCallByValueFunction(a); // copy constructor;
  7.    ...
  8.    a= b; // operator=
  9. } // destructor
kind regards,

Jos
May 12 '07 #4
cmrcm
6
Here are a few hints:
Expand|Select|Wrap|Line Numbers
  1. {
  2.    YourClass a; // default constructor;
  3.    ...
  4.    YourClass b= a; // copy constructor
  5.    ...
  6.    yourCallByValueFunction(a); // copy constructor;
  7.    ...
  8.    a= b; // operator=
  9. } // destructor
kind regards,

Jos
Thanks for reply. I think I am clear about the constructor and operator, could you explain more about the destructor please?
May 12 '07 #5
JosAH
11,448 Expert 8TB
Thanks for reply. I think I am clear about the constructor and operator, could you explain more about the destructor please?
Well, a destructor destructs an object. When the object held resources the
destructor is the place to relinguish those resources (dynamic memory, files,
sockets, screen estate etc. etc.)

kind regards,

Jos

ps. can you show us the paragraph you had to write on the "big three"?
May 12 '07 #6
cmrcm
6
ps. can you show us the paragraph you had to write on the "big three"?
Thanks for explaining. What do you mean by the "paragraph I had"? The question or my answer?
May 12 '07 #7
AdrianH
1,251 Expert 1GB
Here are a few hints:
Expand|Select|Wrap|Line Numbers
  1. {
  2.    YourClass a; // default constructor;
  3.    ...
  4.    YourClass b= a; // copy constructor
  5.    ...
  6.    yourCallByValueFunction(a); // copy constructor;
  7.    ...
  8.    a= b; // operator=
  9. } // destructor
kind regards,

Jos
You also forgot
Expand|Select|Wrap|Line Numbers
  1.    YourClass b= a; // copy constructor
Adrian
May 12 '07 #8
AdrianH
1,251 Expert 1GB
Thanks for explaining. What do you mean by the "paragraph I had"? The question or my answer?
Sounds like you have it under control.

Good luck,


Adrian
May 12 '07 #9
cmrcm
6
Here are a few hints:
Expand|Select|Wrap|Line Numbers
  1. {
  2.    YourClass a; // default constructor;
  3.    ...
  4.    YourClass b= a; // copy constructor
  5.    ...
  6.    yourCallByValueFunction(a); // copy constructor;
  7.    ...
  8.    a= b; // operator=
  9. } // destructor
kind regards,

Jos
One more thing, are the a and b in 'YourClass a', 'YourClass b= a', 'yourCallByValueFunction(a)' and 'a= b' the same? what's the relationship between them?
May 13 '07 #10
JosAH
11,448 Expert 8TB
One more thing, are the a and b in 'YourClass a', 'YourClass b= a', 'yourCallByValueFunction(a)' and 'a= b' the same? what's the relationship between them?
'a' and 'b' are two different objects but both instantiations from the same class.

kind regards,

Jos
May 13 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: SSG | last post by:
How to write a object oriented program in c? give me one example....
1
by: Jean-François Michaud | last post by:
Hello people, I was wondering how it I could implement keep with next logic on lines of text contained within a paragraph. I need to have at least 10 lines of text within a paragraph to be...
20
by: AndyZa | last post by:
Is the following html valid? <p><hr width="50%"></p> Or would the following be more "technically correct"? <p> <hr width="50%"> Do I require the closing </p> tag?
6
by: Paul Wake | last post by:
Do paragraph bottom margins overrule body margins? (To explain what I mean, http://www.xmission.com/~wake/computerrules.html has 5% margins, including the bottom margin, in IE, but not in Firefox....
1
by: abhas59 | last post by:
hi friends, I want to serialize a System.Windows.Documents.Paragraph and for this I have written the following code in the application : mypara cust = new mypara(); Paragraph ph...
15
by: Yogi | last post by:
Hi there, I have a quick question. In my html document, I want to make a new paragraph whenever I have a blank line in the html source. Using <p> and </pevery time is kind of cumbersome (I want...
5
by: RetroMIDI | last post by:
I notice that the <ptag does not always allow the same amount of space. Some websites have about half a line only. When I check their code, they have used just <p>. On other occasions it seems that...
3
by: gentsquash | last post by:
I'm trying to display a paragraph that has a centered phrase, such as this one, in the middle of the paragraph. An example is the section "End of semester project" on my course-page ...
6
by: Haines Brown | last post by:
I'm trying to resolve a contradictory situation in which I have rows going down a page, and each consists of two elements: to the left is a thumbnail image that is a hot link; to its right is a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.