Consider this:
#include <iostream>
using namespace std;
class A{
protected:
void some_function(int params)
{
//inside A: do something A related
}
};
class B: public A{
public:
void call_some_function(int params)
{
some_function(params); // Simple call to A::some_function and NOTHING MORE.
}
};
int main(int argc, char *argv[])
{
A* a = new A();
((B*)(a))->call_some_function(20); // Is it OK ?
}
This code works What is the danger of using it ?