--- Baktavatsala reddy <[EMAIL PROTECTED]>
wrote:
> The Implicit call calls the copy constuctor
> directly. Whereas the explicit call first call the
> copy constructor, creates the object and then again
> calls the assignment operator to assign this newly
> created to an another object.
Not quite, see below.
Ray
>
> Knowledge Seeker <[EMAIL PROTECTED]>
> wrote: Manish wrote:
> > Dear Experts
> >
> > What is the advantage in an explicit call. Both
> look the same to me.
> >
> > Samp obj(10,12); // Implicit call
Calls constructor (not copy constructor) to create and
initialize obj
> > Samp obj = Samp(12,22) // Explicit Call
Calls constructor (not copy constructor) for
Samp(12,22) and creates a temp object, then calls copy
constructor to create and initialize obj with the temp
object, then calls the destructor to delete the temp
object so you get two additional function calls with
the second method.
> >
> > Both compile fine in Borland Turbo C 3.0.
>
> I dare you use a new compiler ;)
>
> > Is it matter of style?
> > Generally which of the two is preferred?
> >
> > Thanks a lot
> >
> > manish
> >
> >
> >
____________________________________________________________________________________Get
the free Yahoo! toolbar and rest assured with the added security of spyware
protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php