Advertisement
3_2004-2005 Coding Standards #146539

Code Example - reinterpret_cast

shows how to use reinterpret_cast :)

AI

AI Summary: 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.

Source Code
original-source
#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");
}
Original Comments (3)
Recovered from Wayback Machine