Re: GObject instantiation hopelessly overcomplicated??



On Sun, 18 Jul 2004, Ryan McDougall wrote:

> In class object instantiation, why does it bother copying memory from
> parent object to final when it will run the parent object's base_init on
> the final object anyways? base_init takes no parameter, so its kind of
> like a default constructor, no?

base_init/bse_finalize are only usefull for parent classes which introduce
a class field (not instance field) that need to be altered/different for each
derived class. an example are set_arg/get_arg or set_property/get_property
functions that a parent class introduce, but which have to be reimplemented
by every derived class that makes use of an arg/property system.
another example are allocation/reference-count based objects, if these are
supposed to be mutable during a class' lifetime, the ordinary pointer copy
provided by the type system isn't good enough and you need base_init/finalize
to do extra copies/releases or ref/unref of that field.

>
> Cheers,
> Ryan
>

---
ciaoTJ




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