
[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <CAABBKK=ufLL2oABCinGZwfzrKVFJ8UOXtjEXQ+1N5zhiAXs4cg@mail.gmail.com> thusly:
I have found this to cause unnecessary methods having to be virtualized in order to replace concrete objects with test objects in a class being tested, which ended up getting quite messy at times, so I essentially had to settle for the "friend" solution.
In C++ you can either use static polymorphism or dynamic polymorphism to get substitutability of test doubles for real collaborators. I've done both, depending on the situation. If I had to choose between which I like least: virtual functions or "friend", I choose friend. I generally consider "friend" declarations a code smell that indicates poor class design. -- "The Direct3D Graphics Pipeline" -- DirectX 9 version available for download <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/> Legalize Adulthood! <http://legalizeadulthood.wordpress.com>