Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!alberta!herald.usask.ca!ccu.umanitoba.ca!rpjday From: rpjday@ccu.umanitoba.ca Newsgroups: comp.lang.c++ Subject: Re: Static typing and OOP efficiency Message-ID: <1991Mar15.204355.10222@ccu.umanitoba.ca> Date: 15 Mar 91 20:43:55 GMT References: <27C523A2.2155@tct.uucp> <66645@brunix.UUCP> <27CE9CDC.4FD2@tct.uucp> <1991Mar4.082637.24821@gpu.utcs.utoronto.ca> Organization: University of Manitoba, Winnipeg, Canada Lines: 26 In article <1991Mar4.082637.24821@gpu.utcs.utoronto.ca> craig@gpu.utcs.utoronto.ca (Craig Hubley) writes: > >When I teach C++, I usually encourage programmers to break those C habits >immediately by avoiding free functions, public members (especially data >members), non-virtual functions, and even to prefer references over pointers. >Multiple inheritance of abstract classes is encouraged, but inheritance for >aggregation only (building up the implementation) is discouraged. This avoids >most of the hassle of protected members, complex flow control, virtual base >classes, and private inheritance, which is more a shorthand for including a >private data member than a form of inheritance. While we're on the topic of teaching, I am putting together a set of lecture notes on C++, and I am interested in collecting practical examples of code to support individual concepts of the language. It should come as no surprise that, the more obscure and infrequently-used the feature of C++, the harder it is to come up with an example to convince rookies that, yes, there really is a use for such a feature. Just teaching the feature is easy. Convincing people that there is a practical use for it is harder, and most of the books I have seen are forced to come up with some fairly contrived examples at times. If anyone out there has there own pet examples for C++, and is willing to share them, I'd love to hear about them. Thanks muchly. R. Day U. of Manitoba