[C++-sig] design question

Stefan Seefeld seefeld at sympatico.ca
Thu Feb 22 15:50:51 CET 2007


Neal Becker wrote:
> I'm interested in any ideas/opinions on the following.  I am building c++
> objects that are compositions of pieces.  The composition is done from
> python.
> 
> For example, class D has a member of type A, where A's behavior is tuned
> through polymorphism (traditional OO design).  Let's say B and C are
> derived from A. Then, I can control this from python by:
> 
> b = B()
> c = C()
> d1 = D (b)
> d2 = D (c)

Yes, that's certainly sensible. However, just to get this level of
polymorphism you only need an abstract factory from python. The holding
type 'D' doesn't need to be exposed to python for this to work. In
fact, it doesn't have to know anything about python itself.

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list