🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3127

typeinfo

#3127
From: John Max Skaller
Date: Mon, 29 Jan 1996 00:05
24 lines
1425 bytes
> 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. ]
Technical Details
Message-ID: <310B7660.4116@suphys.physics.su.oz.au>
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Subject: typeinfo
Message-ID: <310B7660.4116@suphys.physics.su.oz.au>
Originator: fjh@munta.cs.mu.OZ.AU
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: MAXTAL
X-Original-Date: Sun, 28 Jan 1996 23: 13:04 +1000
Date: Mon, 29 Jan 1996 00:05:04 GMT
Approved: fjh@cs.mu.oz.au
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMQwPbeEDnX0m9pzZAQFDJAGAhWeXSz6cXyPrIVvgAsGdVOKvrSCE6VWY
 Hwh+tIkeg9nycMDBwTyS8nK2OvKdgZVb
 =7XmX
X-Mailer: Mozilla 2.0b6a (WinNT; I)