This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Assign pointers of different objects to the same pointer
- From: "Duft Markus" <Markus dot Duft at salomon dot at>
- To: "me22" <me22 dot ca at gmail dot com>
- Cc: "sebastian" <sebastian dot bw at freenet dot de>, <gcc-help at gcc dot gnu dot org>
- Date: Mon, 9 Jul 2007 08:01:40 +0200
- Subject: RE: Assign pointers of different objects to the same pointer
me22 <> wrote:
> On 06/07/07, Duft Markus <Markus.Duft@salomon.at> wrote:
>> void* ptr;
>> // Dynamic cast, checks types at runtime
>> var1 = dynamic_cast<MyType1*>(ptr);
>>
> I'm quite confidant that you can't dynamic_cast from a void*.
>
> ( How would it be able to check? It can't. )
Huh, sorry, i must have been sleeping...... *arg*
Cheers, Markus.
>
>> Also you may want to look at the other *_cast operators
>> (static_cast, etc)...
>>
> Simple description here:
>
http://gpwiki.org/index.php/C_plus_plus:Modern_C_plus_plus:Appendices:Ca
sts
>
> ~ Scott
--
Salomon Automation GmbH - Friesachstrasse 15 - A-8114 Friesach bei Graz
Sitz der Gesellschaft: Friesach bei Graz
UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K
Firmenbuchgericht: Landesgericht fur Zivilrechtssachen Graz