繼承方法我有我的主類,看起來像這樣:主類不能從我的第二類
#include "stdafx.h"
using namespace std;
class MemoryAddressing : Memory {
int _tmain(int argc, _TCHAR* argv[])
{
Memory mem;
int hp = Memory.ReadOffset(0x000000);
}
}
,然後我有我的第二類:
#include <windows.h>
#include <iostream>
using namespace std;
static class Memory {
public : static int ReadOffset(DWORD offset) {
DWORD address = 0x000000;
DWORD pid;
HWND hwnd;
int value = 0;
hwnd = FindWindow(NULL, L"");
if(!hwnd) {
cout << "error 01: Client not found, exiting...\n";
Sleep(2000);
}else {
GetWindowThreadProcessId(hwnd, &pid);
HANDLE handle = OpenProcess(PROCESS_VM_READ, 0, pid);
if(!handle) {
cout << "error 02: no permissions to read process";
}
else {
ReadProcessMemory(handle, (void*) offset, &value, sizeof(value), 0);
}
}
}
};
很明顯,我試圖從我的類繼承ReadOffset
方法在我的MemoryAddressing
類中。我不知道如何去做,似乎這些班級無法溝通。
我已經知道Java和C#,但我認爲C++是非常不同的。
使用公共繼承。即:'class MemoryAddressing:public Memory' –
爲什麼要創建一個mem本地變量? – Csq
這段代碼真的是C++嗎? – undu