在AS内部类 [英] inner class in AS

查看:137
本文介绍了在AS内部类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

 包{
    公共类A {
       VAR试验:字符串;
       公共函数A()
       }

}
 B类{

}
 

在code是在同一个文件,我们称之为B是内部类,那么如何调用B类的构造函数

解决方案

包
{
    大众A级
    {
       VAR试验:字符串;

       公共函数A()
       {
          变种B:B =新的B();
       }
    }
}
B类
{
   公共函数B()
   {
       跟踪('B类');
   }
}

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

解决方案

package
{
    public class A 
    {
       var test:String;

       public function A()
       {
          var b:B = new B();
       }
    }
}
class B
{
   public function B()
   {
       trace('class B');
   }
}

这篇关于在AS内部类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆