Abuse of Object oriented programming today

Well today I violated one of the cores of Object oriented programming. I had 3 classes where I needed access to the private members from another class. I found that C++ you can not only have the friend functions (I knew this one for years) but I figured it would follow if you can have friend functions there should be a way to have a friend object. Well I found my friend object, it is very easy to use just do “friend class “. When you do that you can now access all the private members of the “friend” class as if they were public from the class you specified was the friend. Don’t ask why I needed it is UGLEY and you don’t want to know, but it is the best compromise for what I needed and the constraints I had.

 Post details 

Categories: Technology
Tags: No Tags
Published on: September 8, 2004

 © 2024 - Michael P. O'Connor