I’ve beem trying different approaches for a couple of hours now, with no success so far.
I have a simple method that accepts a parameter of type Section, a simple class. Now, I have some other classes, like Account, that extend Section.
The problem starts when I try to pass one of this extended classes to the method.
Here’s the method and class signatures:
public static function registerSection(option:Class, section:Section):void
public class Account extends Section
The code that I’m trying to run…
Section.registerSection(OptAccount, new Account())
And the compiler-time error:
1067: Implicit coercion of a value of type Account to an unrelated type sections:Section.
If I try to cast it using “Section(new Account())”, it throws the following error during the execution:
TypeError: Error #1034: Type Coercion failed: cannot convert Account@110fdaf9 to sections.Section.
Also,
trace((new Account()) is Section)
yields false.
And this is not the only class that’s having this problem.
Am I missing something here? What could be the problem(s)?