View Single Post

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

Yeah I also think the first one becuse those $var's that I also pass have
nothing to do with object....

The function is not used to change any members of object just uses some
functions that belong to the object itselfe....

Object is also used on the page where the function so the first one seems
reasonable....

Thanx for your oppinion...

Respect....
"^MisterJingo^" <misterjingo@keysurf.net> wrote in message
news:A5CQa.86$B91.77@news-binary.blueyonder.co.uk...
> "^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