Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> - compiler error.



On Wed, 2002-09-18 at 12:15, Paulo Pinto wrote:
> Sorry for the naive question, but what is
> the relation between `Glib::ObjectBase *'
> and `Atk::Object *' ?

http://www.gtkmm.org/gtkmm2/reference/html/classAtk_1_1Object.html

It's a base class. Actually it's a virtual base class. I think I have
learnt that static_cast<> can never be used to cast down from a virtual
base class, so none of these dynamic_cast<>s can be changed to
static_cast<>s.

That's unless we avoid the problem by storing a Glib::Object* in the
GObject instead of a Glib::ObjectBase*, when we know that that's what it
is. But that would require some larger changes. 

By the way, Glib::ObjectBase exists so that Glib::Object and
Glib::Interface can share a base class:
http://www.gtkmm.org/gtkmm2/reference/html/classGlib_1_1ObjectBase.html

-- 
Murray Cumming
murrayc usa net
www.murrayc.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]