help please

F

fighterman19

I want to ask about copy constructor.
is the line sum=huge1.add(huge2) will call the copy constructor?
int main()
{
HUGE_INT huge1(0),huge2(1), sum;

sum=huge1.add(huge2);

//are these two line also a copy constructor?
huge1.assign(huge2);
huge2.assign(sum);

return 0;

};
 
J

JustSomeGuy

have you tried putting trace code in the copy constructor of the class to
see when it is called?
Are you aware of the rule of three?
 
M

Mike Wahler

fighterman19 said:
I want to ask about copy constructor.
is the line sum=huge1.add(huge2) will call the copy constructor?

We can't tell without seeing the definition of 'add()'.
Does it take its argument by reference?
int main()
{
HUGE_INT huge1(0),huge2(1), sum;

sum=huge1.add(huge2);

//are these two line also a copy constructor?
huge1.assign(huge2);
huge2.assign(sum);

We can't tell without seeing the definition of 'assign()'.
Does it take its argument by reference?

-Mike
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top