📄 reinterp.cpp
字号:
// Reinterpret cast
#include <typeinfo>
class Dog {
public:
Dog() { }
virtual void fetch() = 0;
};
class Dalmation : public Dog {
public:
Dalmation() { }
virtual void fetch();
};
void Dalmation::fetch()
{
}
class Unrelated {
public:
Unrelated() { }
};
void foo(Unrelated&)
{ }
int main()
{
Dalmation cairo;
Dog& dog = cairo;
Unrelated& eek = reinterpret_cast<Unrelated&>(dog);
foo(eek);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -