Code Example - reinterpret_cast
shows how to use reinterpret_cast :)
AI
AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
소스 코드
#include<iostream>
using namespace std;
class M {
public:
int x;
int y;
int z;
void print()
{
cout << "x: " << x << " y: " << y << " z: " << z << endl;
}
};
int main()
{
M m;
int *p = reinterpret_cast<int*>(&m);
*p = 0;
p++;
*p = 5;
p++;
*p = 7;
m.print();
system("pause");
}
원본 댓글 (3)
Wayback Machine에서 복구됨