I have a C++ application which has the following classes:
class AAA
class BBB
inherits fromAAA
class CCC
inherits fromAAA
class DDD
inherits fromCCC
(All of the classes are marked as public
)
Now I have the following map:
map <DWORD, AAA*>
I find an AAA
object in the map
, by a DWORD id
, but now I want to know what is the type of AAA
:
this will be the logic:
if(AAA is BBB)
{
...
}
if(AAA is CCC)
{
...
}
if(AAA is DDD)
{
...
}
Do you know how to write it in C++ (without adding a polymorphic function of getType()
)?