#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <sys/time.h>
using namespace std;
class HogeSDKClass {
public:
HogeSDKClass()
: value_(9999)
{
}
void print() {
printf("%d\n", value_);
}
protected:
int value_; // この値は不可侵である
};
class HogeSDKClassHack : public HogeSDKClass {
public:
void hackValue() {
this->value_ = 1000;
}
};
HogeSDKClass* getHogeSDKInstance() {
return new HogeSDKClass(); // これはSDKからやってくる
}
int main() {
HogeSDKClass* hoge = getHogeSDKInstance();
hoge->print(); // この値を書き換えたい……。
HogeSDKClassHack* hogeHack = static_cast<HogeSDKClassHack*>(hoge);
hogeHack->hackValue();
hogeHack->print();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+CiNpbmNsdWRlIDxzeXMvdGltZS5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgSG9nZVNES0NsYXNzIHsKcHVibGljOgogICAgSG9nZVNES0NsYXNzKCkKICAgIDogdmFsdWVfKDk5OTkpCiAgICB7CiAgICAJCiAgICB9Cgl2b2lkIHByaW50KCkgewoJCXByaW50ZigiJWRcbiIsIHZhbHVlXyk7Cgl9CnByb3RlY3RlZDoKICAgIGludCB2YWx1ZV87IC8vIOOBk+OBruWApOOBr+S4jeWPr+S+teOBp+OBguOCiwp9OwoKY2xhc3MgSG9nZVNES0NsYXNzSGFjayA6IHB1YmxpYyBIb2dlU0RLQ2xhc3MgewpwdWJsaWM6Cgl2b2lkIGhhY2tWYWx1ZSgpIHsKCQl0aGlzLT52YWx1ZV8gPSAxMDAwOwoJfQoJCn07CgpIb2dlU0RLQ2xhc3MqIGdldEhvZ2VTREtJbnN0YW5jZSgpIHsKCXJldHVybiBuZXcgSG9nZVNES0NsYXNzKCk7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