Xref: utzoo comp.lang.eiffel:1340 comp.object:2448 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pdn!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Keywords: oop, ood, Eiffel, inheritance, information hiding Message-ID: <27A44773.5537@tct.uucp> Date: 28 Jan 91 15:46:59 GMT References: <1991Jan23.224203.3206@runx.oz.au> <1991Jan24.214652.18515@Think.COM> <1077@tetrauk.UUCP> Organization: Teltronics/TCT, Sarasota, FL Lines: 32 According to rick@tetrauk.UUCP (Rick Jones): >In article <1991Jan24.214652.18515@Think.COM> barmar@think.com (Barry Margolin) writes: >>I like C++'s solution to this, the private/protected/public distinction. >>The private members of a class are only visible within the class, internal >>to the "black box". Protected members are visible to derived classes ... >>And public members are fully exported. > >The problem I see with this approach is that the designer of a class has to >anticipate every possible way in which his class may be used by another >programmer. I'm sorry, but I don't believe that any method of code reuse -- whether inheritance, delegation or "editor block-copy subroutines" -- will ever be able to guarantee 100% reuse *without modification*. The C++ public/protected/private specifications are a concise way for the programmer of a class to express his expectations as to future derivation from the given class. If a second programmer thinks that she needs to get at a private member of such a class, that is a hint that the base class's author didn't anticipate the second programmer's intended use of the class. It will imply to a good programmer that either (1) the derivation in question is a Bad Idea, or (2) the base class requires some adjustment before the derivation will work. I don't see how eliminating the "private" keyword would fix this basic difficulty with deriving from another programmer's classes. -- Chip Salzenberg at Teltronics/TCT , "If Usenet exists, then what is its mailing address?" -- me "c/o The Daily Planet, Metropolis." -- Jeff Daiell