Manish wrote: > Dear Experts > > What is the advantage in an explicit call. Both look the same to me. > > Samp obj(10,12); // Implicit call > Simply a 'named' object (with name obj) is created. > Samp obj = Samp(12,22) // Explicit Call > In this an intermediary unnamed temporary object is created which is then assigned to 'obj'.
Create a constructor for the class Samp, and see how many times it is called for both of above :) > Both compile fine in Borland Turbo C 3.0. Is it matter of style? > Generally which of the two is preferred? > > Dont you want to reduce the 'execution' time, for creating an object. (If you need 'proper' object to be created, else if you want a 'deformed' object you may overload the assignment operator to do something unexpected and use the second decleration :) ) > Thanks a lot > > manish > > >
