NYCPHP Meetup

NYPHP.org

[nycphp-talk] OO - when classes are related, who gets which method?

Chris Snyder chris at psydeshow.org
Wed Jun 11 12:13:42 EDT 2003


Hans Zaunere wrote:

>>$related = $object->createRelated();
>>or
>>$related = new Related; $related->create(&$object);
>>
>But don't they do different things?  The first case returns a Related object,
>while the second associates $object with an object of class Related.  
>
Yep, they do the same thing, because every Related is associated with an 
Object.

I decided to go with my gut and develop $related->create(&$object) 
because I figure that makes the class more portable. With a little more 
thought it made sense. In this case, Objects don't care how to create 
Relateds-- it's really none of their business. :-)

Thanks Hans!




More information about the talk mailing list