help a newbie with GObject



Hello,

I am trying to wrap my head around the GObject/GType system, but because
of the lack of good documentation I am having trouble understanding it.

Do you know any good tutorial on GObject ?
I found the tutorial available on developer.gnome.org
(http://www.le-hacker.org/papers/gobject/) not for newbies.

So I figured that the best way to understand anything is too have a
working equivalent of something I can understand.
Can someone be kind and translate the following Java classes in C using
GObject ?

(I am guessing that it should be a trivial task for someone experienced
with the GObject system)

Thanks in advance ...


abstract class Animal
{
	void feed()
	{
		print("Feeding some animal");
	}
}

class Dog extends Animal
{
	static int legs = 4;

	String name;
	int age;

	public Dog(String name, int age)
	{
		this.name = name;
		this.age = age;
	}
	
	void feed()
	{
		print("Feeding a canine named " + this.name);
	}
}

// .......

Animal animals[] = {
	new Dog("Bella", 2),
	new Dog("Toto", 3)
};

for (int i=0; i<animals.length; i++)
	animals[i].feed();




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