Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2005-01-12 17:54:00


Hello Boosters,
I know it's really BAD idea but sometimes ... especially if you
ABSOLUTELY sure ... you may access protected member functions
of an object without touching a class of that object.

Two steps are required. First, at global scope in .cpp file (never in a header!)
you should declare all functions you want to access later in this file:

    DECLARE_ACCESS_PROTECTED_FUNCTIONS( (foo)(bar) )

and, then you can access them:

    X x; // you want to access x's protected function bar. No problem:
    long r1 = ACCESS_PROTECTED_FUNCTION(X, x, bar, (4, 5, 6) );

Please, don't use if you're not sure. You've been warned!

-- 
Alexander Nasonov





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk