Christian <christians / syd.microforte.com.au> wrote: > // some_action.h > void onSomeAction(Moveable *); > void onSomeAction(Plane *) ; > > At least it is explicit. You will get told by the compiler if you try to > land a tank, or refuel a human. No, I wouldn't write code exactly like this > (there is no notion of const for a start), although I prefer 'global' > (namespaced) functions that represent actions overloaded by type than > methods that are within scope of a class. > You /can/ have encapsulation without classes. Assuming you have something > other than just Objects, that is. It's called a namespace (no, C++ > namespaces are not well executed). > That's called generic programming with models. A model in this context is an > interface contract that attempts to guarantee *both* syntacic and semantic > conformance, without the constraint of commonality of type. begin() gives > you the start, and end() gives you the end. > To modify an object's behavior, you should modify the behaviour > as-it-relates-to-that-type, not *necessarily* the type itself. This is what > I mean by functional programming. Of course, some things are class-specific, > such as copy and compare. It looks as if you're in need of multimethods such as are available in Common Lisp and Dylan. Also, predicate classes and Cecil come to mind (though only in a researchy mood). Michael -- Michael Schuerig mailto:schuerig / acm.org http://www.schuerig.de/michael/