You can't use a var to implement a getter... you have to write a getter.
And it has to have exactly the same signature.
 
- Gordon

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of simonjpalmer
Sent: Wednesday, November 21, 2007 2:21 PM
To: [email protected]
Subject: [flexcoders] Interfaces and Implements



Hi, I am having a problem with defining and using interfaces on my AS3
classes. Here's my scenario...

class A implements IA{}
class B implements IB{}

class Wrapper implements IWrapper
{
public var a:A;
public var b:B;
}

interface IWrapper
{
function get a():IA;
function get b():IB;
}

When I compile this I get an error:

"Interface method get a in namespace IWrapper is implemented with an
incompatible signature in class Wrapper"

A implements IA and get a() returns an instance of class A, so why the
error? 

This is making it a bit hard to code against interfaces rather than
concrete classes.

Any ideas?



 

Reply via email to