Hi, François.

A "using" directive can be used for things other than namespaces.

In this case, the "using" directive introduces all instances of
"supports" and "accepts" from the class Drawable scope (I think
they're all in the public scope of that class) into the public scope
of class ShapeDrawable; according to the comment, this is a work
around to prevent name hiding when using a declared pointer/reference
to ShapeDrawable or its derived classes.

By NOT declaring and overriding all instances of virtual member
functions "support" and "accepts", ShapeDrawable would hide those
other instances without the "using" directive.  With the "using"
directive, ShapeDrawable only has to declare and override those
instances in which it needs different behavior from the inherited
instances.

Pick up your favorite C++ reference for a more thorough discussion of
the "using" directive.  For related material, try the following FAQ:

http://www.parashift.com/c++-faq-lite/strange-inheritance.html

Happy coding...

D.J.

On Wed, Jan 6, 2010 at 4:52 PM, François Bodic <[email protected]> wrote:
> Hi,
>
> I cannot figure out the role of the next two lines in the ShapeDrawable 
> implementation. I thought that the keyword "using" was only for namespaces...
> Can someone help me?
>
> using Drawable::supports
> using Drawable::accept
>
>
> Thank you!
>
> Cheers,
> François
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=22187#22187
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to