Click here to Skip to main content
16,018,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to get specified windows users or group? Pin
Syouki_kou16-Mar-10 17:50
Syouki_kou16-Mar-10 17:50 
QuestionMessage Removed Pin
15-Mar-10 22:18
parksi15-Mar-10 22:18 
AnswerRe: gdi+ how to save a 16-color GIF image file Pin
Iain Clarke, Warrior Programmer15-Mar-10 23:00
Iain Clarke, Warrior Programmer15-Mar-10 23:00 
Questionshow/hide ms-word toolbar in C++ Builder ??? Pin
sy111115-Mar-10 16:25
sy111115-Mar-10 16:25 
QuestionHow to get base class name of derived class Pin
sito4215-Mar-10 14:55
sito4215-Mar-10 14:55 
AnswerRe: How to get base class name of derived class Pin
Avi Berger15-Mar-10 15:49
Avi Berger15-Mar-10 15:49 
GeneralRe: How to get base class name of derived class Pin
sito4215-Mar-10 17:04
sito4215-Mar-10 17:04 
AnswerRe: How to get base class name of derived class Pin
Avi Berger15-Mar-10 17:45
Avi Berger15-Mar-10 17:45 
OK, that gives me a different picture of what is going on.

It is, of course, preferable to try do things using polymorphism and not have to make this distinction.

Failing that, I believe this is what you are looking for:

{

    class A { };
    class B : public A { };
    class C : public A { };

    class BDerived: public B { };
    class CDerived: public C { };

    std::map<A*> m;

    ...


    A* pA = m[ key1 ];
    B* pB = dynamic_cast<B *>( pA );  // failed pointer cast returns NULL
    C* pC = dynamic_cast<C *>( pA );

    if ( pB )
    {
        //is a pointer to B or B derived
        ...
    }
    else if ( pC )
    {
        //is a pointer to C or C derived
        ...
    }
    else
    {
        //is not a pointer to B, C or B, C derived
        ...
    }
}
Please do not read this signature.

GeneralRe: How to get base class name of derived class Pin
sito4215-Mar-10 20:24
sito4215-Mar-10 20:24 
AnswerRe: How to get base class name of derived class Pin
Adam Roderick J15-Mar-10 18:07
Adam Roderick J15-Mar-10 18:07 
Questionpersistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 11:13
permutations15-Mar-10 11:13 
AnswerRe: persistent crash on tester's computers that I can't reproduce Pin
LouisLewis15-Mar-10 11:21
LouisLewis15-Mar-10 11:21 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 11:34
permutations15-Mar-10 11:34 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
LouisLewis15-Mar-10 11:43
LouisLewis15-Mar-10 11:43 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 12:07
permutations15-Mar-10 12:07 
AnswerRe: persistent crash on tester's computers that I can't reproduce Pin
Avi Berger15-Mar-10 15:13
Avi Berger15-Mar-10 15:13 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 17:01
permutations15-Mar-10 17:01 
AnswerRe: persistent crash on tester's computers that I can't reproduce Pin
Luc Pattyn15-Mar-10 16:02
sitebuilderLuc Pattyn15-Mar-10 16:02 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 17:26
permutations15-Mar-10 17:26 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
Luc Pattyn15-Mar-10 17:30
sitebuilderLuc Pattyn15-Mar-10 17:30 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations15-Mar-10 17:37
permutations15-Mar-10 17:37 
AnswerRe: persistent crash on tester's computers that I can't reproduce Pin
Adam Roderick J15-Mar-10 20:25
Adam Roderick J15-Mar-10 20:25 
AnswerRe: persistent crash on tester's computers that I can't reproduce Pin
Roger Allen16-Mar-10 5:01
Roger Allen16-Mar-10 5:01 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
permutations16-Mar-10 5:13
permutations16-Mar-10 5:13 
GeneralRe: persistent crash on tester's computers that I can't reproduce Pin
Roger Allen16-Mar-10 6:03
Roger Allen16-Mar-10 6:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.