I'm trying to define interface in which one method (initPage) needs to have different arguments in every implementation. How can I do this? Using ...args for me is not good, because I'm loosing strong type checking.
public interface IPage {
function initPage(...args):void;
function showPage():void;
function hidePage():void;
function removePage():void;
}
You know you can implements more than one Interface?
I think you should maintain your actual Interface, minus the "problematic" method, and create another Interfaces, each one with a different method
public interface IPage
{
function showPage():void;
function hidePage():void;
function removePage():void;
}
public interface IPrettyPage
{
function initPage(p:PrettyArg);
}
public interface IUglyPage
{
function initPage(u:UglyArg);
}
// your implementation Class
package
{
public class Page extends Sprite implements IPage, IPrettyPage
{
// Implementation
}
}
Anyway, here's an example with another good idea, BUT is a Java code: http://www.java2s.com/Code/Java/Language-Basics/Implementmultipleinterfaces.htm
I didn't tested, but I'm almost sure this issue is different in AS3.