[Vala] interfaces



following compiles without warning/error but at runtime it tells me
(process:6285): GLib-GObject-WARNING **: cannot add interface type
`JJJ' to type `BBB' which does not conform to prerequisite `III'

/* [public|private] interface <name> {
**   constant/method/delegate/signal
** }
*/

interface III {
 public const int i = 2 ;
 public abstract void m ();
}

interface JJJ : III {
 // public void m () { stdout.printf("J.m() ueberdeckt I.m(). 'new'
ist nicht erforderlich\n"); }
 public void n () { stdout.printf("J.n()\n"); }
}

abstract class AAA {
}

class BBB : AAA,JJJ,III {
 int _j ;
 public double d ;

 public int j { get{return _j;} set{_j=value;} }
 public BBB(){ j=i+12; d=1.23; }
 public void m() { stdout.printf("I.m() in class B implementiert\n"); }
}

int main ( string[] args ) {
 var b = new BBB();
 stdout.printf("%d %d %f\n",((III)b).i,b.j,b.d);
 b.m();
 b.n();
 return 0 ;
}

when 'class A : J/*,I*/ {}' a similiar error at compile time.

is there actually need to declare all interfaces in class-declaration, i.e.
interface i1 {} ; interface i2:i1 {} ... interface i99:i98 {}
class C : i99,...,i1 {}
???

thanks in advance
andreas



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