Is g_object_class_override_property only meant for interfaces? (original) (raw)

As far as I can tell if a property of the same name is defined in a child object then it already overrides the parent class implementation ? if so, is there no point at all in this scenario to using g_object_class_override_property in the child class ?

ebassi (Emmanuele Bassi) March 28, 2025, 9:39am 2

In theory, you could use GParamSpecOverride and g_object_class_override_property() for anything that is “interface”-like and does not have class storage for properties. In practice, though: yes, it’s an API only for interfaces.

Classes can install a property with the same name as a property of their parent and override behaviours like validation range, or flags—but make sure to take the Liskov substitution principle into account if you do so.

system (system) Closed April 27, 2025, 9:40am 3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.