Suppose I wish to be able to handle:
- objects with a ‘blah_A’ method
- objects with a ‘blah_B’ method
- objects with both a ‘blah_A’ and a ‘blah_B’ method
Additionally, suppose that all interfaces must support ‘blah_X’
To achieve the above, I construct four interfaces as follows:
interface X
sub blah_X()
interface A aggregates X
sub blah_A
interface B aggregates X
sub blah_B
interface BOTH aggregates A,B
Trouble is, that Xojo fails to compile this, throwing error “This interface contains a cyclical interface aggregation”
Could someone explain why this cannot be compiled?
I suppose that BOTH can see two copies of blah_X - one through aggregating A and one through aggregating B, so it might seem ambiguous.
But we know that both these blah_X should route to the same implementation of the method in the object, so any ambiguity is easily resolved.