Sender: Babyfrog (century frog), letter area: programming Title: Programmer and Hacker Send Station: Sun and Moonlight (April 11, 2004 07:29:15 Wednesday)
Topic: There is a C class class a {int value; public: a (int n = 0): value (n) {} int getValue () {return value;}}; please use some way to the outside Change the value of the private member A :: Value.
Programmer's possible practice: class a {int value; public: a (int N = 0): value (n) {} int getValue () {return value;} void setValue (int N) {value = n;}} ;
Void f () {a a; a.setValue (5);
Hacker's possible practices: void f () {a a; * (int *) & a) = 5;}
Conclusion: Programmer is accustomed to following existing restrictions to increase existing things. Hackers are used to using existing things to break existing restrictions. - I don't like the loneliness and loneliness when they put them in their hands, I can't imagine whether they have gone and escape when they experience fails? But in any case, they succeeded, just like a lot of success, they paid their own heart and sweat, and finally harvested applause and flowers. ※ Source: · Sun Moonlight Bbs.fudan.edu.cn · http [from: 211.156.16.245]