[osg-users] dynamic_cast equivalent in osgDotNet
Christophe Medard
christophe.medard at oktal.fr
Tue Oct 2 04:50:27 PDT 2007
That's just because what you do is strange : OsgGA.GUIActionAdapter isn' a
child class of OsgViewer.Viewer.
OsgViewer.View aa;
OsgViewer.Viewer viewer = aa as OsgViewer.Viewer;
as a valid example perfectly works.
Not only does the 'as' cast your aa OsgViewer.View reference to an
OsgViewer.Viewer reference, but it also test the validity of such a cast,
making viewer as null is something goes wrong.
Hope that helps.
--
Christophe Médard
Société OKTAL (http://www.oktal.fr)
2 impasse Boudeville
31100 Toulouse (France)
Tél. : (+33) 5 62 11 50 10
Fax : (+33) 5 62 11 50 29
----- Original Message -----
From: "Christoffer Markusson" <ch.markusson at gmail.com>
To: <osg-users at lists.openscenegraph.org>
Sent: Tuesday, October 02, 2007 1:24 PM
Subject: Re: [osg-users] dynamic_cast equivalent in osgDotNet
> Hi Christophe,
>
> That gives error message
>
> "Cannot convert type 'OsgGA.GUIActionAdapter' to 'OsgViewer.Viewer'
> via a built-in conversion".
>
> Doing a direct cast, "viewer = (OsgViewer.Viewer)aa", also gives a
> error message when compiling in Visual Studio 2005.
>
> Christoffer
>
More information about the osg-users
mailing list