Hi Steven The method doesn't effect the state of anything . It just returns some information. The context is: class A is the Catalogue and B is the Cart. Usually they are separate but I want to show a flag relating to the basket/cart in the catalogue against each product. Really I am putting the method in the Cart class because it seems to logically belong there - for organisational reasons. I see what you mean about coupling though. It could get messy!
Regards Kropotkin Steven Siebert wrote: > > It depends. (always the expected answer with an OOP design question =) > > Generally, if the method you are calling on class A does not work > on/effect the state of a specific object, its a canidate to be a > static (class) method. However, you should be careful about coupling > your objects and understand what you are doing when you do. If you > feel comfortable for that method be a static method, though, you're > probably good to do so. Generally....depending.... > > =) > > Hope this helps. > > Steve > > On Thu, Jan 29, 2009 at 12:54 PM, kropotkin <enquir...@mms-oxford.com> > wrote: >> >> Hi >> >> In general is it better to use a class method or object method? E.g I >> have a >> class A which provides certain functionality. I just want to use one of >> its >> methods in another class B. Is it better to inistantiate class A and do >> and >> object call or just do A->myMethod() ? The method doesn't need a >> reference >> to itself passed in so from that point of view it doesn't matter >> >> Thanks >> >> Justin >> -- >> View this message in context: >> http://www.nabble.com/Class-method-or-Object-method--tp21732172p21732172.html >> Sent from the mod_perl - General mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Class-method-or-Object-method--tp21732172p21733697.html Sent from the mod_perl - General mailing list archive at Nabble.com.