Created
January 16, 2013 14:51
-
-
Save ktimothy/4547638 to your computer and use it in GitHub Desktop.
перегрузка в AS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.Sprite; | |
/** | |
* | |
* | |
* @author timothy.kovalev | |
*/ | |
public class OverloadTest extends Sprite | |
{ | |
public function OverloadTest() | |
{ | |
var manager:OverloadManager = new OverloadManager(); | |
manager.toggle(); | |
trace(manager.string); | |
manager.toggle(); | |
trace(manager.string); | |
} | |
} | |
} | |
internal final class OverloadManager | |
{ | |
private namespace ONE; | |
private namespace TWO; | |
private var _mode:Namespace; | |
ONE var _string:String = "one"; | |
TWO var _string:String = "two"; | |
public function OverloadManager() | |
{ | |
} | |
public function toggle():void | |
{ | |
_mode = (_mode == ONE) ? TWO : ONE; | |
} | |
public function get string():String | |
{ | |
return _mode::_string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment