#include <iostream>
using namespace std;
class CDummy
{
public:
int ConstCastSolve(const string & sQuestion) const
{
return const_cast<CDummy *>(this)->Answer(sQuestion);
}
int HardCastSolve(const string & sQuestion) const
{
typedef int (CDummy::*TConstPtr)(const string &) const;
TConstPtr pMethodPointer =
reinterpret_cast<TConstPtr>(&CDummy::Answer);
return (this->*pMethodPointer)(sQuestion);
}
private:
int Answer(const string & sQuestion)
{
return 42;
}
};
int main()
{
CDummy dummyObject;
cout << dummyObject.ConstCastSolve("Answer");
return 0;
}