Skip to content

Instantly share code, notes, and snippets.

@ktimothy
Created January 16, 2013 14:51
Show Gist options
  • Save ktimothy/4547638 to your computer and use it in GitHub Desktop.
Save ktimothy/4547638 to your computer and use it in GitHub Desktop.
перегрузка в AS
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