Access to protected member functions

12 Jan
2005
12 Jan
'05
10:54 p.m.
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
7459
Age (days ago)
7459
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alexander Nasonov