Path: utzoo!attcan!uunet!munnari.oz.au!mtiame!jep From: jep@mtiame.oz (Jesper Peterson) Newsgroups: comp.object Subject: Re: ??Bidirectional Inheritence?? Message-ID: <304@mtiame.oz> Date: 23 Oct 90 01:52:21 GMT References: <6957@uwm.edu> Organization: Metal Trades Industry Association, Victoria, Australia. Lines: 30 In article <6957@uwm.edu> ctumey@csd4.csd.uwm.edu (Carol T Tumey) writes: >[....] >In the small amount of reading I have done on OOP/OOD I have >not seen anything on the subject of parents inheriting >values from their children nor can I see the benfits of >such hierarchical incest :-) Do virtual functions in C++ qualify? (I'm asking) An example given in Bjarne Stroustrup's book is: [page 37] A "Shape" class which does not have the attributes required to sensibly respond ro a "draw" message. It does, however, declare the "draw" function as "virtual". Derive some classes from Shape, such as Circle, Square etc. Each of these properly define the "draw" function. You can now store a mixture of Circles and Squares in an array of Shapes. You can loop through this array and sensibly send "draw" messages to instances of Shape rather than the specialised classes. As I understand it, Shape effectively "inherits" "draw" from it's children. I'm new at OOP so speak slowly when you respond :-) Jesper. -- ACSnet: jep@mtiame.mtia.oz UUCP: ...!uunet!munnari!mtiame.oz!jep [...] I had to leave out reality to keep the post clean and to the point. - jeremy@milton.u.washington.edu (Jeremy York) in rec.music.misc