View Single Post

  #3 (permalink)  
Old 07-14-2003
^MisterJingo^
 
Posts: n/a
Default Re: object in a function!?

"^MisterJingo^" <misterjingo@keysurf.net> wrote in message
news:_3CQa.70$B91.17@news-binary.blueyonder.co.uk
> "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.)


Although if the function is used to just change members stored in the
object, the possibility exits to make it a method of the object.


Reply With Quote