Am 24.08.2013 um 18:36 schrieb Thiago Macieira <thiago.macie...@intel.com>:

> On sábado, 24 de agosto de 2013 12:00:07, Till Oliver Knoll wrote:
>> C++ makes this easy for you:
>> 
>> #define private public
>> #include "Foo.h"
> 
> Doesn't work with MSVC, 

Ha! I /knew/ it! MS is totally not adhering to "the standard" *rant* *rant*...

Okay, you got me there, I never actually tried it myself, even though 
unit-testing private methods was also the first thing which came to my mind as 
being very useful when I learnt this Evil Trick here on qt-interest (I think).

The context was a similar one: trying pointer arithmetic, iterating over 
virtual function tables, casting... until someone just came up with this 
#define thing. At that time the simplicity and elegance just blew my mind - C++ 
rocks! It just gave me a rocket launcher to shot into my foot! ;)

> since the protection level is encoded in the member 
> function's name.


I am pretty sure that even the naming might be overcome with a little #define 
wizardry, no? ;)

Cheers,
  Oliver


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to