[study] - interface

by gaina
...
@author gaina
♥0 | Line 31 | Modified 2010-08-08 08:24:41 | MIT License
play

ActionScript3 source code

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

package 
{
    import flash.display.Sprite;
    import flash.text.TextField;
    
    /**
     * ...
     * @author gaina
     */
     
    public class Main extends Sprite 
    {
        
        public function Main():void 
        {
            init();
        }
        
        private function init():void 
        {
            var unko:TestClass = new TestClass();
            var tf:TextField = new TextField();
            tf.text = unko.sampleTest("unko");
            addChild(tf);
        }
        
    }
    
}

//IMPLEMENT INTERFACE
class TestClass implements ITest
{   
    public function TestClass();     
    public function sampleTest(str:String = ""):String
    {
        return str + "\.unko";
    }
}

//INTERFACE
interface ITest 
{
    function sampleTest(str:String = ""):String;
}