Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: private/protected/public implementation Keywords: compiler, keywords Message-ID: <10340@alice.UUCP> Date: 16 Jan 90 02:34:38 GMT References: <626@watserv1.waterloo.edu> Distribution: comp Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 25 In article <626@watserv1.waterloo.edu>, mgardi@watserv1.waterloo.edu (Mutual Life) writes: > Could someone give me a short description of how the compiler restricts > access to private/protected elements? > When I look at the C code generated, I don't see any difference in > the code regardless of where I place the data. > p. Correct. Visibility restrictions affect only whether or not a given program is legal. That is, the compiler checks visibility during compilation and either accepts the program or not. Changing visibility should not (and in AT&T C++ does not) affect the object code generated for a program. This is an important property for debugging. If you're writing a class that doesn't work, and you didn't design debugging scaffolding into the class from the beginning, you often have to make members public temporarily so you can print their values. It would be a real pain if this were to change the behavior of the program. -- --Andrew Koenig ark@europa.att.com