Return the direct parent type of the passed in type.
If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
Example: Get the parent-type:
public interface Interface : Object {}
public abstract class AbstractGObject : Object, Interface {}
public abstract class MyGObject : AbstractGObject {}
public static int main (string[] args) {
// Output:
// ``AbstractGObject``
// ``GObject``
Type type = typeof (MyGObject);
for (Type p = type.parent (); p != 0 ; p = p.parent ()) {
print ("%s\n", p.name ());
}
return 0;
}
valac --pkg gobject-2.0 GLib.Type.parent.vala
type |
the derived type |
the parent type |