I have been trying to access private members of a class in a base project for unittesting the public void methods of the class in another project. These methods modify the private members, so this is my motivation. I have to work with visual studio 2008 for this.
Now the Microsoft tutorial suggests to compile the base project into a static lib, since that would allow to access to private members. https://msdn.microsoft.com/en-us/library/hh419385.aspx However, after adding the reference on the project and inputting the .lib to the linker, I still get the error that the private member cant be accessed. However the .lib is obviously found and read.
When i declare my Test project as a friend class in the base class, it works as expected, but I'm trying to change as little as possible (nothing) on the base code.
I just wonder what's behind Microsoft's suggestion. Is it even supposed to work? Is my version of Visual Studio (=2008) the Problem? Thanks for your help.
I read about ways to access private members, but they are all rather messy and not what I mean to do. For example: Can I access private members from outside the class without using friends?