Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!mcnc!thorin!unc!barkley From: barkley@unc.cs.unc.edu (Matthew Barkley) Newsgroups: comp.lang.smalltalk Subject: Re: Duplication of instance variables in subclasses Summary: Static versus dynamic Message-ID: <5818@thorin.cs.unc.edu> Date: 10 Dec 88 22:19:12 GMT References: <1397@aucs.UUCP> Sender: news@thorin.cs.unc.edu Distribution: na Lines: 22 In article <1397@aucs.UUCP>, 831059l@aucs.UUCP (Steven Langlois) writes: > > Is it possible to define a subclass that just adds some new methods > (and possibly some new instance variable of its own) to its superClass but > does not duplicate the instance variables of the superClass so that the new > methods access the superClass variables and not the subClass's inheritance of > the variable? I have had similar problems with Smalltalk. They seem to come from the mis- conception that an instance of a class has anything at all to do with an in- stance of its superclass. In your example, one may have dozens of Entity instances (the class) and NO Simulation instances (the superclass). If I understand correctly, inheritance is static. That is, a class inherits all the function of the hierarchy above it, including variable names, but none of the *values* of the variables. I have posted this reply instead of e-mailing it because it may be wrong; if so, someone please post or mail a correction. Matt Barkley barkley@unc.cs.unc.edu Any opinions expressed are not necessarily shared by anyone else, and may not even be my own. How an organization can have an opinion is beyond me.