Is g_object_class_override_property only meant for interfaces?

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 ?

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.

1 Like