[Newbie] design question

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sat May 12 15:34:48 EDT 2007


idaku2 at gmail.com wrote:
> Suppose I have class ShoppingCart which has one method called
> buy(), and class Buyer who has one reference to ShoppingCart... 
> Can I also have method buy() in class Buyer, which will then
> called ShoppingCard.buy(), and also do some other stuff?  Is this
> legal design pattern, have methods with same name?

In principle, this is legal.

But OTOH, how could a ShoppingCart "buy" something? In my world,
Buyers "buy" when using ShoppingCarts.

Regards,


Björn

-- 
BOFH excuse #445:

Browser's cookie is corrupted -- someone's been nibbling on it.




More information about the Python-list mailing list