From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.ada:2964 comp.object:462 comp.lang.misc:3693 Path: utzoo!attcan!uunet!samsung!usc!apple!amdahl!pacbell!osc!tma From: tma@osc.COM (Tim Atkins) Newsgroups: comp.lang.ada,comp.object,comp.lang.misc Subject: Re: Integrating concurrent & O-O programming Message-ID: <1667@osc.COM> Date: 21 Nov 89 04:09:20 GMT References: <7062@hubcap.clemson.edu> Reply-To: tma@osc.UUCP (Tim Atkins) Followup-To: comp.lang.ada Organization: Object Sciences Corp., Menlo Park, CA List-Id: In article <7062@hubcap.clemson.edu> wtwolfe@hubcap.clemson.edu (Bill Wolfe) writes: > ...consider the interference that occurs between class inheritance > and encapsulation when subclasses are allowed to access freely the > instance variables of the parent class [Sny86]. In this case we may > say that support for inheritance diminishes the degree of encapsulation > that was achieved without inheritance... I have heard this before and, frankly, I don't get it. The subclass has inherited data structure definition from the parent class. Therefore its instances will contain instances of the parent data structure. This is totally local to the object! Only the definition was inherited. Why is this a bad thing? Why does it break encapsulation? I understood the encapsulation wrt data provided by OO techniques to simply state that instance data should not be accessed directly but only through a method defined on the class. Therefore, inheritance does not seem to break encapsulation. I would appreciate it if someone could set me straight here. - Tim