Actionscript 3 具有相同方法名称的超级接口和超级类

Actionscript 3 具有相同方法名称的超级接口和超级类,actionscript-3,apache-flex,flex4.5,flex-spark,Actionscript 3,Apache Flex,Flex4.5,Flex Spark,我正在尝试创建spark datagrid项目渲染器。此项渲染器扩展复选框,并实现IGridItemRenderer public class CellCheckBoxItemRenderer extends CheckBox implements IGridItemRenderer 当我实现IGridItemRenderer时,我需要实现接口方法,我对以下方法有问题: public function get hovered():Boolean { } public function set

我正在尝试创建spark datagrid项目渲染器。此项渲染器扩展复选框,并实现IGridItemRenderer

public class CellCheckBoxItemRenderer extends CheckBox implements IGridItemRenderer
当我实现IGridItemRenderer时,我需要实现接口方法,我对以下方法有问题:

public function get hovered():Boolean
{
}

public function set hovered(value:Boolean):void
{
}
因为方法也是从复选框继承的

编辑 函数的签名

//spark checkbox signature
protected function get hovered():Boolean
protected function set hovered(value:Boolean):void

上面的签名属于接口IGridItemRenderer

问题是,接口在设计上只指定公共函数的签名,而
复选框中的函数设置为受保护

public class CellCheckBoxItemRenderer extends CheckBox implements IGridItemRenderer
唯一的解决办法是:

  • CellCheckBoxItemRenderer
  • 从接口中删除声明
  • 更改
    复选框
    ,使悬停的
    成为公共属性
  • 可以使用as3 commons字节码项目动态更改访问器(http://www.as3commons.org/as3-commons-bytecode/emit.html),但我不是100%肯定

我想
igriditemrender
的实现是更重要的部分,因此您可以在数据网格中使用它。
复选框
只提供了功能,如果我认为存在冲突,您不必扩展它

public class CellCheckBoxItemRenderer implements IGridItemRenderer {

    private var checkBox:CheckBox;

    public function getCheckBox {
        return checkBox;
    }

    //...
}

如果
CheckBox
要实现任何有用的接口,您也可以在渲染器中实现它们,并将方法委托给该复选框,这样可以封装整个复选框。但这里的情况并非如此。

类和接口中的方法是否具有相同的签名?您能否在此列出函数的签名?也许我或其他人会给你一些建议workaround@Eugeny89我已经编辑了这个问题