How to implement D class which implements A, B & C classes.
I am understanding multiple inheritance in dart. In the below program the D class implements A, B, & C classes but its generating compile time error that 'D.foo' ('String Function()') isn't a valid override of 'A.foo' ('int Function()').
I have went through some of the previous post in SO but still unsure how to fix this issue:
- void Function(int) isn't a valid override of void Function(dynamic)
- void Function(Subype) isn't a valid override of void Function(ParentType)
Source
class $ {
void bar() {
print("\$ bar");
}
}
class A extends $ {
int foo() {
print("A's foo");
return 0;
}
}
class B extends $ {
String foo() {
print("B's foo");
return "Bla";
}
}
class C extends $ {
void foo() {
print("C's foo");
}
}
class D implements A, B, C {
@override
void bar() {}
String foo() { // Error @ this line seems its not a valid override
return "Object()";
}
}