We have a structure that accepts C function pointers:
int one(int x)
{
}
int two(int x)
{
}
struct Cstruct
{
int (*fn1)(int);
int (*fn2)(int);
};
Now I have a C++ class that has below methods:
class A
{
public:
int one(int x)
{
}
int two(int x)
{
}
int three(int x)
{
struct Cstruct cstr = {&this->one, &this->two};
}
};
While trying to initialize class A methods address to a instance of Cstruct compiler is giving error of an invalid conversion?
How can I assign the Class member function address to Cstruct?
Aucun commentaire:
Enregistrer un commentaire