Sorry for the double post

---------- Forwarded message ----------
From: Matthieu Brucher <[EMAIL PROTECTED]>
Date: 15 nov. 2007 23:38
Subject: Re: Python Design Patterns - composition vs. inheritance
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>



2007/11/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> In learning about design patterns, I've seen discussion about using
> inheritance when an object's relationship to another object is 'is-a'
> and composition when the relationship is 'has-a'.


Another way to express this is to say :
- inheritance when you want to reuse an interface
- compositon when you want to reuse the implementation
IIRC this is the approach of Bruce Eckel.

Matthieu
-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher

-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to