Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inner class in AS

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

like image 386
jason Avatar asked Aug 29 '10 08:08

jason


People also ask

What is meant by an inner class?

In object-oriented programming (OOP), an inner class or nested class is a class declared entirely within the body of another class or interface. It is distinguished from a subclass.

What is inner and outer class in Java?

In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called the nested class, and the class that holds the inner class is called the outer class.

How do inner classes work in Java?

Java inner class is defined inside the body of another class. Java inner class can be declared private, public, protected, or with default access whereas an outer class can have only public or default access. Java Nested classes are divided into two types.


1 Answers

package
{
    public class A 
    {
       var test:String;

       public function A()
       {
          var b:B = new B();
       }
    }
}
class B
{
   public function B()
   {
       trace('class B');
   }
}
like image 68
PatrickS Avatar answered Oct 18 '22 16:10

PatrickS