Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!xanadu!ravi From: ravi@xanadu.com (Ravi Pandya) Newsgroups: comp.lang.c++ Subject: Why just public, protected, and private? Keywords: protection categories, modularity Message-ID: <1991Feb9.021746.13835@xanadu.com> Date: 9 Feb 91 02:17:46 GMT Organization: Xanadu Operating Company Lines: 37 For some strange reason, C++ allows private messages to be sent either to this or to another compatible object, but protected messages can only be sent to this. I have encountered several cases where I would like to declare a message that can only be sent from a subclass of the declaring class, but can be sent to any compatible object. I have also run into occasions where I would like to declare a method that can only be sent to this, and only from the declaring class. I would like to see the protection categories extended to include the following: =================================================================== || \ RECEIVER || only to this | to any object || || SENDER \ || | of compatible type || =================================================================== || from declaring || secret | private || || class only || | || ------------------------------------------------------------------- || from any subclass || protected | confidential || || of declaring class || | || ------------------------------------------------------------------- || from any class || equivalent to | public || || || protected | || =================================================================== Does anyone know why this particular choice was taken? It would be more consistent, and in my experience more useful, to put protected member functions in the right hand column, allowing them to be sent to any compatible type. --ravi Ravi Pandya Xanadu Operating Company 550 California Avenue Suite 101 Palo Alto, CA 94306 415 856 4112 ext 122 415 856 2251 fax ravi@xanadu.com