Source Code PointerFun with private Class Members

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

HalfWayToHell333

Jr.Coder
Silenced
Full Member
Nobleman
Jun 23, 2014
80
783
3
Using a Pointer to move thru all private class members to get their Vals,
just like accessing an Array ;)

C++:
#include <iostream>
#include <string>

#define recap(type,Ptr) reinterpret_cast<type*>(Ptr)

class Victim{
private:
	int val;
	char val2;
	float val3;
	std::string val4;
public:
	Victim() :val(333), val2('!'), val3(666),val4("g o t c h a \n s u c k e r"){}
};

int main(){
	using namespace std;
	Victim test;

	int* evilptr = (int*)&test;
	cout << *recap(int, evilptr) << endl;
	evilptr++;
	cout << *recap(char,evilptr) << endl;
	evilptr++;
	cout << *recap(float, evilptr) << endl;
	evilptr++;
	//evilptr++; uncomment when compiling with 64 Bit!
	cout << *recap(string, evilptr) << endl;
	cin.get();

}
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
That's really cool, I had no clue that could be done! Thanks for sharing :D
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods