Path: utzoo!mnetor!tmsoft!dptcdc!jarvis.csri.toronto.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!cernvax!olsen!franco From: franco@olsen.UUCP (Franco Monti) Newsgroups: comp.lang.c++ Subject: Smalltalk-80 like inheritance in C++ possible ? Message-ID: <110@honold.UUCP> Date: 3 Mar 89 18:36:11 GMT Reply-To: franco@honold.UUCP (Franco Monti) Organization: Olsen & Associates, Zurich, Switzerland Lines: 82 Hi, Allow me a question which may be trivial for you guys. I'm a beginner of C++ and therefore interested in the following flavour of inheritance: In Smalltalk-80 you can use inheritance as in this sample program: (***********************************) class name One superclass Object instance methods test ^1 result1 ^self test class name Two superclass One instance methods test ^2 class name Three superclass Two instance methods result2 ^self result1 result3 ^super test (*************************************) Now create new instances: example1 <- One new example2 <- Two new example3 <- Three new and consider scenarios like this: expression result ---------- ------ example1 test 1 example1 result1 1 example2 test 2 example2 result1 2 example3 test 2 example3 result2 2 example3 result3 2 Now comes the tricky part: How can I translate the behavior of the code outline above to the appropiate structures in C++ ? How do you move *up and down* in a given class hierarchy, like in my little example, using C++ ? Is it possible to cover this examples with an easy to understand and well structured program in C++, how is this best done ? Could anybody give me a pointer ? Thanx Franco M. Monti Olsen & Associates Seefeldstr. 233 8008 Zuerich Switzerland