flash on 2013-2-18

by TmskSt
♥0 | Line 29 | Modified 2013-05-26 13:35:39 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import com.actionscriptbible.Example;
    public class FlashTest extends Example {
        public function FlashTest() {
            // write as3 code here..
            const t:Super = new Super();
            const c1:Child = new Child("c1");
            const c2:Super = new Child("c2");
            
            trace(t.ex());
            trace(c1.ex());
            trace(c2.ex());
        }
    }
}

class Super {
    public function ex():String {
        return "Super#ex :" + f();
    }
    
    protected function f():String {
        return "Super";
    }
}

class Child extends Super {
    
    public function Child(id:String) { this.id = id; }
    private var id:String;
    
    protected override function f():String {
        return "Child#" + id;
    }

}