Wednesday, April 17, 2013

Accessing private members in C++


#define private public
#include "A.h"
#undef private
 
void accessPrivateState()
{
    A a;
    a.x = 3;
}

Source: http://www.drdobbs.com/cpp/testing-complex-c-systems/240147275?pgno=2

No comments: