Re: Properties in subclasses



Jacob Kroon wrote:

Hi.

Lets say I've written an abstract parent class that registers a property.
From this parent class I derive several subclasses. I wan't some of the these
subclasses to have read/write access to the property, but some subclasses
should only have read access to it.

Is this possible, or am I wrong from a design point-of-view ?

Well, you have an interesting... interpretaion of properties :)

properties are kind of like a generic way to talk to an object, I couldnt
speak for their initial purpose but not all class variables are represented
by properties, usually if you are implementing an object; you will just cast
and access. (if you are wondering about the permission flags on pspecs,
they effect the code calling g_object_new/set/get).

An interesting feature; is g_object_override_property(), a function
that lets you redirect the set_property target function a said property on an instance.
so using that you can "respond differently" to g_object_set/get if you are a
different implementation.

Cheers,
                                       -Tristan




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