Re: [Dev-C++] Passing by value or reference to constructorinitialiation list
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2003-01-10 10:03:12
|
Well I think passing by reference is better because the objects could be
large, which means more on the stack and thus more overhead, but are there
any side effects to passing by reference to the constructor in this way?
>From: Banjo Donila <ner...@my...>
>To: Daniel Glenfield <sp...@ho...>
>Subject: Re: [Dev-C++] Passing by value or reference to
>constructorinitialiation list
>Date: 10 Jan 2003 17:49:28 +0800
>
>it depends on what you want to happen
>
>On Fri, 2003-01-10 at 17:19, Daniel Glenfield wrote:
> >
> >
> > I would like to know whether it is better to pass the following string
> > objects and integer by value or reference to my constructor
>initialisation
> > list.
> >
> > Vehicle::Vehicle
> > (
> > String& VehicleName,
> > String& VehicleType,
> > int SerialNumber
> > ):
> > mVehicleName(VehicleName),
> > mVehicleType(VehicleType),
> > mSerialNumber(SerialNumber)
> > {
> > }
> >
> > an integer is only 4 bytes I think, so by value would be fine, but what
> > about the string objects? Can I pass by reference?
> >
> >
> > _________________________________________________________________
> > Protect your PC - get McAfee.com VirusScan Online
> > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > http://www.vasoftware.com
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
|