[osg-users] dynamic_cast equivalent in osgDotNet

Christoffer Markusson ch.markusson at gmail.com
Tue Oct 2 04:24:08 PDT 2007


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

>Christophe Medard christophe.medard at oktal.fr
>Tue Oct 2 04:16:17 PDT 2007
>
>It's basically the 'as' C# cast operator.
>
>osgGA::GUIActionAdapter& aa;
>osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa );
>
>in C++ becomes :
>
>OsgGA.GUIActionAdapter aa;
>OsgViewer.Viewer viewer = aa as OsgViewer.Viewer;
>
>
>>2007/10/2, Christoffer Markusson <ch.markusson at gmail.com>:
>> Hi,
>>
>> What is the equivalence in C# using the osgDotNet wrappers to do
the following?
>>
>> osgGA::GUIActionAdapter& aa
>> osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa );
>>
>> Christoffer
>>



More information about the osg-users mailing list