Re: RefPtr and inheritance



<snip>

> Glib::RefPtr refB = Glib::RefPtr(new B());
> Glib::RefPtr  refA = Glib::RefPtr (refB);

<snip>

If the foregoing actually appears in your code, I wonder how it
successfully compiles since you didn't define a template for
Glib::RefPtr<T>.

It should be written:

Glib::RefPtr<B> refB = B::create();
Glib::RefPtr<A> refA = refB;

The foregoing assumes that class B has a create function.

Bob Caryl



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