design patterns - actionscript-3: refactor interface inheritance to get rid of ambiguous reference error -
Think that the two interfaces have been arranged through composite method, in one of them, settling
Methods are among other methods:
Interfaces extend to ICMAPent IEL ... {function displacement (): zero; } Interface iFefe {...}
There are some more things in the implementation (say a id
) and there are two more interfaces:
Interface iComment Life Spans to ILEF {function get id (): string; } Interface ICommonComponent ICommonLeaf, Expands IComponent {}
So far so good. But there is another interface in which there is dissection
method also:
isomization interface ... ... displacement (): zero; }
and ISomething
inherited by ICommonLeaf:
enhances the interface ICommonLeaf ILEaf, ISoming {function get id (): String; }
As soon as the dissection
method is applied to an example, which implements the ICommonComponent
interface, the compiler is a vague reference Fails with error because isomething
has dissection
and ILeaf
also have a settlement
method, both separately I live in the interface (
I wonder if
-
ICMAPonent
/ Code>,
IELF
andicing
do not change - The composite structure should also be
ICommonLeaf
& amp;ICommonComponent
- Implementation and
ICommonLeaf
& Amp;ICommonComponent
must be consistent withISomething
.
This may be an actioncript-3 specific problem I can not test How do other languages (eg Java) handle things like this.
To solve the problem of diamond, a view on this near C # But I can basically make the method out of your interface and create a new "IDisposable".
If the same name like "id" is used twice, then it looks like a problem in your code with a vague name we have started adding prefix for properties and methods. Imagine that you have a property "name" that is related to two different things. Like "DisplayName" and "Unique Name".
It also helps with autocompletion. If any DisplayObject is an ILayoutObject and yout type displayObject.layout
you get everything ready for the layout
Comments
Post a Comment