Topic: typeinfo


Author: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Date: 1996/01/29
Raw View
> class beatha{public:virtual ~beatha(){};}
> class duine:public beatha{};
> class gael: public duine {};
>
> beatha *pd=new gael;
> if(typeid(pd)==typeid(duine)
> {       cout<<"duine";
> }
> ...
> does "duine" get printed here or not?

No. pd denotes an object of exact type "gael".
This is not the same type as "duine".
[Note "beatha" is polymorphic]

--
John Max Skaller               voice: 61-2-566-2189
81 Glebe Point Rd              fax:   61-2-660-0850
GLEBE NSW 2037                 web: http://www.maxtal.com.au/~skaller/
AUSTRALIA                      email: skaller@maxtal.com.au
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]