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
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.
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.
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.
package { public class A { var test:String; public function A() { var b:B = new B(); } } } class B { public function B() { trace('class B'); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With