Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!tmsoft!masnet!rose!phil.calvin From: phil.calvin@rose.uucp (PHIL CALVIN) Newsgroups: comp.lang.c++ Distribution: world Subject: MEMBER ACCESS Message-ID: <97edfa6b92f028446f60@rose.uucp> Date: Wed, 29 May 91 20:20:00 EST Organization: Rose Media, ON, CANADA Lines: 47 A language feature I'd like to see... A class has certain data members, for efficiency reasons, I would like to grant the USER read-only access. EX: class COORD { public: // Don't modify just read.. int x,y; ... }; Obviously, the comment does little more than _encourage_ the user to modify the value. My proposal is to have language support for this concept: EX: class COORD { const public: int x,y; // Not an lvalue, compile will flag as errors. const protected: int a,b; // Same thing, derived class may read, not write ... } A couple of points: 1. Obviously const private makes no sense 2. class members and friends always have write access (unless, of course the object is const) Any remarks/flames etc?? Has this facility been discussed and rejected?? If so, would someone summarize reasons and email me?? Thanks.. ..Phil ---