Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!bloom-beacon!eru!luth!sunic!tut!tukki!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.lang.c++ Subject: Re: private to a class or to an object? Message-ID: <1334@tukki.jyu.fi> Date: 20 Sep 89 07:14:24 GMT References: <517@wizard.UUCP> Reply-To: markku@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) Organization: University of Jyvaskyla, Finland Lines: 25 In article <517@wizard.UUCP> john@wizard.UUCP (John Danner) writes: > [example deleted] > >Shouldn't private data be private to a single object and not accessible >to any object of that class? Is this something that is safe to take >advantage of as far as compatibility with future versions of cfront? There are object-oriented languages in which the unit of encapsulation is an object (e.g. Smalltalk), and those in which it is a class. Both approaches have their pros and cons. C++ belongs to the latter camp, and this is part of the fundamental philosophy of C++, so you can safely rely upon it. However: The new restriction on access to _protected_ parts of objects from subclass objects in C++ release 2.0 has been recently criticised in this newsgroup, because some of us think it violates the clear principle of class-level encapsulation. Markku Sakkinen Department of Computer Science University of Jyvaskyla (a's with umlauts) Seminaarinkatu 15 SF-40100 Jyvaskyla (umlauts again) Finland