Thx for the advice. really helpful. I just knew about default operator =
assignment.
Anyway, programming 101:
i have this kind of loop
for(int k = 0; k<10; k++)
{
Vertex3 v1(0, 0, k);
//process v1 here
}
and another version (but same function)
Vertex3 v1
for(int k = 0; k<10; k++)
{
v1.set(0, 0, k);
//process v1 here
}
I have no intention to store v1. I just want to process it and get the process
result.
Is the second one more efficient than the second one?
When I construct an object with same variable more than once, does it create 10
object or it just replace the first one?
Thanks
--- On Sat, 11/15/08, Thomas Hruska <[EMAIL PROTECTED]> wrote:
> From: Thomas Hruska <[EMAIL PROTECTED]>
> Subject: Re: [c-prog] Constructor calling
> To: [email protected]
> Date: Saturday, November 15, 2008, 3:50 PM
>
> Because the second approach is valid C++ and the first
> isn't.
>
> The first approach calls the _default_ constructor. The
> next three
> lines are simply invalid C++.
>
> If you want to assign, use the assignment operator.
>
> BTW, the compiler automatically creates a default
> constructor, copy
> constructor, assignment operator, and destructor for you if
> you don't
> define them. Based on what you are trying to do with your
> copy
> constructor, you don't seem to actually need it.
>
> --
> Thomas Hruska
> CubicleSoft President
> Ph: 517-803-4197
>
> *NEW* MyTaskFocus 1.1
> Get on task. Stay on task.
>
> http://www.CubicleSoft.com/MyTaskFocus/