i want to know how to access virtual table for a class this is my attempt to do so ........
#include<iostream>
using namespace std;
class sample
{
public:
virtual void fun(int q)
{
cout<<"fun"<<endl;
}
void g()
{
int *p=(int *)this;
p=(int *)*p;
p=(int *)*p;
void ( sample::*pfun)(int);
pfun=(void(sample::*)(int))p;
// pfun=(void (sample::*)(int))p;
(*pfun)(25);
}
void abc()
{
cout<<"abc"<<endl;
}
};
int main()
{
sample s;
s.g();
}
here i am getting error while casting the in the line
pfun=(void(sample::*)(int))p;