Re: object in a function!?
"point" <info@caanproduction.com> wrote in message
news:beuo13014jt@enews2.newsguy.com
> I have one little issue here....
>
> let say that I have a function ,
>
> and in that function some object functions are used....
>
> which is better
>
> a) function something($,var1,$var2,$var3,&$object)
> {
> //and then keep using object functions
> }
>
> or
>
> b)function something($,var1,$var2,$var3)
> {
> $object = & NEW someClass;
> //and then keep using object functions
> }
>
> I used the first solution but want to hear some more oppinions.....
>
> respect...
> point
Well the second solution scopes the object to the function, if the object is
needed outside of it (which I guess it is) then number two isn't really
feasible. Passing the object by reference, which you have done, is sensible
(on the information you have given us.)
|