Re: GObject docs improvements



On Mon, Feb 12, 2007 at 02:05:27PM -0600, Shixin Zeng wrote:

1) Is interface the GObject's way to implement multiple inheritance?

It's the other way round -- whether for GObject or not.

Interfaces (in the more abstract sense) are the primary
entities.  Interfaces tell what an object can do, they
determine what an object is.  Inheritance represents
convenient and natural means to express that an object is
something: it is an object of all its parent types too, i.e.
it has all the parent interfaces.  It is also quite
restrictive; other common approaches include formal
interfaces (i.e. formal claims what operations can be
performed with the object) as in Java and GObject, and
duck-typing (interfaces with the granularity of a single
method or attribute) possible for example in Python and
Smalltalk.

Multiple inheritance is just a method to overcome the
limitations on the interfaces an object can possibly claim
to have that come from the strictly hierearchical inheritance.

Many languages allow more than one of these approaches.

2)How its intefaces handled, when a class is derived? Will the child
classes possess the same interfaces, if they don't want to reimplement
them?

Yes, it will (a non-transitive is-a relation would be very
very strange).

Yeti


--
Whatever.



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