This is purely a theoretical question, I know that if someone declares a method private, you probably shouldn\'t call it. I managed to call private virtual methods and chang
See my blog post. I'm reposting the code here
template
struct result {
/* export it ... */
typedef typename Tag::type type;
static type ptr;
};
template
typename result::type result::ptr;
template
struct rob : result {
/* fill it ... */
struct filler {
filler() { result::ptr = p; }
};
static filler filler_obj;
};
template
typename rob::filler rob::filler_obj;
Some class with private members
struct A {
private:
void f() {
std::cout << "proof!" << std::endl;
}
};
And how to access them
struct Af { typedef void(A::*type)(); };
template class rob;
int main() {
A a;
(a.*result::ptr)();
}