operator keyword for cast ?
GLib Value and Variant support cast like C# cast if operator is implemented. Is it planned to introduce this type of function for class or at least for GLib Object ?
public class MyObject : Object {
public MyObject (string value) {
Object (value : value);
}
public string value { get; set construct; }
public string to_string() {
return value;
}
// or classic 'from_string' method ?
public static operator MyObject (string val) {
return new MyObject (val);
}
}
public static void main (string[] args) {
string str = "dummy";
MyObject obj = (MyObject)str;
MyObject object = new MyObject ("toto");
string val = (string)object;
}