开发者

Actionscript - Call subclass constructor from base class

开发者 https://www.devze.com 2023-02-07 17:12 出处:网络
I want to create an instance of a subclass from inside a static superclass method. H开发者_如何学编程ere is an example:

I want to create an instance of a subclass from inside a static superclass method. H开发者_如何学编程ere is an example:

class Base
{
    public static function createSubclassInstance()
    {
        //What do I do here?
        return new this.getSubclassType();
    }
}

class Sub extends Base
{
}

I want to create a new Sub instance by calling:

var s:Sub = Sub.createSubclassInstance();


static properties aren't inherited

0

精彩评论

暂无评论...
验证码 换一张
取 消