inner class in AS
Asked Answered
V

1

14

for example:

 package{
    public class A {
       var test:String;
       public function A()
       }

}
 class B{

}

the code is in the same file, we call B is inner class, then how to call the constructor of class B

Vest answered 29/8, 2010 at 8:3 Comment(2)
your class B has no constructor in the above definition.Rachealrachel
You don't need to define a constructor function, it's optional.Szombathely
M
22
package
{
    public class A 
    {
       var test:String;

       public function A()
       {
          var b:B = new B();
       }
    }
}
class B
{
   public function B()
   {
       trace('class B');
   }
}
Mors answered 29/8, 2010 at 9:49 Comment(1)
Does this really function as an inner class? For example, can class B access private members of class A in this setup?Helfant

© 2022 - 2024 — McMap. All rights reserved.