Code Example - reinterpret_cast
shows how to use reinterpret_cast :)
AI
KI-Zusammenfassung: 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.
Quellcode
#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");
}
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine