I would like to use a Generic class, so
class MyClass<T> {
T property;
...
public void Print() {
stdout.printf(property.to_string())
}
}
The compiler fails with:
The name `to_string' does not exist in the context of `T'
And that does kinda make sense to me, the question is.. I guess in a
generic fashion:
How can I call a method on a Generic type? For the above example, I've
tried casting:
((Object) property).to_string() tells me that GLib.Object has no
to_string() (I thought it did, but may have confused it with C#'s
object.
(string) property compiles but segfaults.
Is there an Interface for to_string() i can check for, e.g:
if (property is IStringable) ((IStringable) property).to_string()
Thanks,
-a
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list