- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
#include "stdafx.h"
class CTest
{
private:
virtual void Print()
{
_tprintf( _T("He he ;)\n"));
}
};
class CX
{
public:
virtual void BlaBla();
};
int _tmain(int argc, _TCHAR* argv[])
{
CTest t;
//error C2248: 'CTest::Print' : cannot access private member declared in class 'test'
//t.Print();
//It works
((void (*)(void))((int*)(*(int*)&t))[0])();
//It works, too
((CX*)&t)->BlaBla();
return 0;
}
guest 07.02.2009 21:58 # 0