🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: dynamic_cast<T> implementation...

#2309
From: Robert Martin
Date: Thu, 26 Oct 1995 08:56
28 lines
1466 bytes
Michael Cook <mcook@cognex.com> writes:

>What if I use `dynamic_cast' where `static_cast' would be sufficient?  Is the
>type /still/ required to be polymorphic?  For example, given this:

> struct B {};
> struct D : B {};
> D* d;

>is this expression valid?

> dynamic_cast<B*>(d)

As I understand the DWP, the argument of dynamic_cast need only be
polymorphic in those cases where there is no implicit conversion from
the argument to the requested type. 
-- 
Robert Martin       | Design Consulting   | Training courses offered:
Object Mentor Assoc.| rmartin@oma.com     |   OOA/D, C++, Advanced OO
2080 Cranbrook Rd.  | Tel: (708) 918-1004 |   Mgt. Overview of OOT
Green Oaks IL 60048 | Fax: (708) 918-1023 | Development Contracts.


---
[ 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: <1995Oct26.031626.8091@rcmcon.com>
Path: arc1-ca.pugleaf.net!news.duke.edu!agate!agate!Matt
References: <9510191610.ZM21213@yosemite.eai.com> <u9hh141x8p.fsf@yorick.cygnus.com> <r4rb05s7jj.fsf@pluto.cognex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.duke.edu!agate!agate!Matt
From: rmartin@rcmcon.com (Robert Martin)
Newsgroups: comp.std.c++
Subject: Re: dynamic_cast<T> implementation...
Date: 26 Oct 1995 08:56:52 GMT
Organization: R. C. M. Consulting Inc. 708-918-1004
Approved: Matt@Austern
Message-ID: <1995Oct26.031626.8091@rcmcon.com>
References: <9510191610.ZM21213@yosemite.eai.com>  <u9hh141x8p.fsf@yorick.cygnus.com> <r4rb05s7jj.fsf@pluto.cognex.com>
NNTP-Posting-Host: austern.hip.berkeley.edu