From: Sean Middleditch Date: 2002-04-12T02:56:46+09:00 Subject: Re: Is eval a code/design smell? On Thu, 2002-04-11 at 13:50, Paul Brannan wrote: > On Fri, Apr 12, 2002 at 02:34:29AM +0900, Alan Chen wrote: > > Note that C++ has the friend keyword that does something similiar. Its > > just with ruby you always have friends ;). Last time I looked, Python had > > a similiar "security bug" via __dict__. > > The difference is that with C++, friends have to be declared by the > class (Bar cannot declare himself to be Foo's friend; Foo must declare > Bar to be his friend). > > One "security bug" that C++ has is that you can simply do: > #define private public > #include "Foo.hpp" > > but I think this has undefined behavior. You can probably do something > similar with friend, though it would be trickier. Of course, with C++, you do directly access any byte in memory owned by the program you want, so things like public/private/friend are simply there as "safety" checks - not any kind of true protection or security mechanism. > > Paul >