Error with dynamic_cast
-
class Filter;
typedef void (Filter::*PFN)();
class Filter
{
public:
void ProcessPart();
void MyProcessPart();struct Pair\_t { Pair\_t(int d, PFN n) : iid(d), pfn(n) {} int iid; PFN pfn; private: Pair\_t& operator=(const Pair\_t&); };
};
void Filter::ProcessPart()
{
PFN pfn2;//Here I am getting error C2681 pfn2 = dynamic\_cast (&Filter::ProcessPart); Pair\_t(9, pfn2);
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}I am not able to solve this. Any help? Thanks
-
class Filter;
typedef void (Filter::*PFN)();
class Filter
{
public:
void ProcessPart();
void MyProcessPart();struct Pair\_t { Pair\_t(int d, PFN n) : iid(d), pfn(n) {} int iid; PFN pfn; private: Pair\_t& operator=(const Pair\_t&); };
};
void Filter::ProcessPart()
{
PFN pfn2;//Here I am getting error C2681 pfn2 = dynamic\_cast (&Filter::ProcessPart); Pair\_t(9, pfn2);
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}I am not able to solve this. Any help? Thanks
You are trying to cast a function address to a pointer to a class, which is illegal.
-
You are trying to cast a function address to a pointer to a class, which is illegal.
Ya I got it. Thanks Richard MacCutchan
-
class Filter;
typedef void (Filter::*PFN)();
class Filter
{
public:
void ProcessPart();
void MyProcessPart();struct Pair\_t { Pair\_t(int d, PFN n) : iid(d), pfn(n) {} int iid; PFN pfn; private: Pair\_t& operator=(const Pair\_t&); };
};
void Filter::ProcessPart()
{
PFN pfn2;//Here I am getting error C2681 pfn2 = dynamic\_cast (&Filter::ProcessPart); Pair\_t(9, pfn2);
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}I am not able to solve this. Any help? Thanks
-
class Filter;
typedef void (Filter::*PFN)();
class Filter
{
public:
void ProcessPart();
void MyProcessPart();struct Pair\_t { Pair\_t(int d, PFN n) : iid(d), pfn(n) {} int iid; PFN pfn; private: Pair\_t& operator=(const Pair\_t&); };
};
void Filter::ProcessPart()
{
PFN pfn2;//Here I am getting error C2681 pfn2 = dynamic\_cast (&Filter::ProcessPart); Pair\_t(9, pfn2);
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}I am not able to solve this. Any help? Thanks
You've already had help from the clever people here, but it would have helped them if you'd put the error in the posting too. If you make it easy to help you, more people will try. Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
-
You've already had help from the clever people here, but it would have helped them if you'd put the error in the posting too. If you make it easy to help you, more people will try. Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
Iain Clarke, Warrior Programmer wrote:
if you'd put the error in the posting too.
Ahem, it's in the original question, as a C++ comment.
-
Iain Clarke, Warrior Programmer wrote:
if you'd put the error in the posting too.
Ahem, it's in the original question, as a C++ comment.
OK, I'll partially let him off then! But pasting the whole error message is still wise. Do *you* remember E1234 off by heart? Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
-
OK, I'll partially let him off then! But pasting the whole error message is still wise. Do *you* remember E1234 off by heart? Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
Iain Clarke, Warrior Programmer wrote:
But pasting the whole error message is still wise.
I agree entirely.
Iain Clarke, Warrior Programmer wrote:
Do *you* remember E1234 off by heart?
No, but I can spell MSDN and even Google. ;)