class EasyClass {
private:
std::string answer = "you don't know how to break it";
public:
std::string GetAnswer() const {
return answer;
}
};
// Начало решения
class HakerClass {
std::string answer = "but i know how to deal with it";
public:
std::string GetAnswer() const {
return answer;
}
};
EasyClass SolverFunction() {
HakerClass hc{};
HakerClass* phc = &hc;
EasyClass* pec = reinterpret_cast(phc);
return *pec;
}
// Конец решения
int main() {
EasyClass res = SolverFunction();
assert(res.GetAnswer() == "but i know how to deal with it");
}
class EasyClass {
private:
std::string answer = "you don't know how to break it";
public:
std::string GetAnswer() const {
return "but i know how to deal with it";
}
};