pikkio
September 28th, 2008, 07:32 PM
Hi! I'm new to Vala (http://www.vala-project.org) programming, and actually I'm reading the tutorial right now.
I'll go right to the point: I can't get Interfaces working. Bear in mind that I'm quite comfortable with the Java programming, so it's not a matter of understanding the OOP principles behind interfaces.
Despite that, I can't get compiled even this example code from the tutorial!
using GLib;
public interface ITest {
public abstract int data_1 { get; set; }
public abstract void function_1();
}
public class Test1 : ITest {
public int data_1 { get; set; }
public void function_1() {
}
}
public class Test : Object {
public static void main(string[] args) {
Test1 t = new Test1();
t.function_1();
ITest i = t;
i.function_1();
}
}
These are the two errors I got:
pikkio:vala % valac -o interfaces interfaces.vala
interfaces2.vala:22.13-22.13: error: missing class prerequisite for interface `ITest'
ITest i = t;
^
interfaces2.vala:22.3-22.7: error: missing class prerequisite for interface `ITest'
ITest i = t;
^^^^^
Compilation failed: 2 error(s), 0 warning(s)
Thanks in advance for any suggestion.
P.S. On my Hardy installation I've got the 0.3.5 version of Vala libs
I'll go right to the point: I can't get Interfaces working. Bear in mind that I'm quite comfortable with the Java programming, so it's not a matter of understanding the OOP principles behind interfaces.
Despite that, I can't get compiled even this example code from the tutorial!
using GLib;
public interface ITest {
public abstract int data_1 { get; set; }
public abstract void function_1();
}
public class Test1 : ITest {
public int data_1 { get; set; }
public void function_1() {
}
}
public class Test : Object {
public static void main(string[] args) {
Test1 t = new Test1();
t.function_1();
ITest i = t;
i.function_1();
}
}
These are the two errors I got:
pikkio:vala % valac -o interfaces interfaces.vala
interfaces2.vala:22.13-22.13: error: missing class prerequisite for interface `ITest'
ITest i = t;
^
interfaces2.vala:22.3-22.7: error: missing class prerequisite for interface `ITest'
ITest i = t;
^^^^^
Compilation failed: 2 error(s), 0 warning(s)
Thanks in advance for any suggestion.
P.S. On my Hardy installation I've got the 0.3.5 version of Vala libs