プロトタイプ継承(?)

by Nicolas forked from new function (diff: 8)
♥0 | Line 23 | Modified 2010-12-15 19:44:45 | MIT License
play

ActionScript3 source code

/**
 * Copyright Nicolas ( http://wonderfl.net/user/Nicolas )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/qH8G
 */

// forked from paq's new function
package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    
    /**
     * function は new できる
     * @author paq89
     */
    public class Main extends Sprite
    {
        public function Main():void
        {
            function func():void {
                this.str = "wonderfl"
            }
            function funcEx():void{
                this.str2 = "jsdo.it";
            }
            funcEx.prototype = new func();

            var f:Object = new funcEx();
            var tf:TextField = new TextField();
            tf.text = f.str + "\n" + f.str2;
            addChild(tf);
        }
    }
    
}

Forked