Created
May 23, 2013 16:21
-
-
Save zachwlewis/5637329 to your computer and use it in GitHub Desktop.
A simple class containing protected variables, getters and setters, and optional arguments.
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
public class Foo extends Object | |
{ | |
// Variables | |
protected var _bar:String; | |
/** Contains a user-set string or "foo". Will never be blank. */ | |
public function get bar():String { return _bar; } | |
public function set bar(value:String) | |
{ | |
if (value != "") | |
{ | |
_bar = value; | |
} | |
else | |
{ | |
_bar = "foo"; | |
} | |
} | |
/** Constructor */ | |
public function Foo(s:String = "foo") | |
{ | |
_bar = s; | |
} | |
/** | |
* Appends a string to the Foo's bar and returns the new string. | |
* @param s The string to append to the Foo's bar. | |
* @return A new string containing the Foo's bar and s. | |
*/ | |
public function appendString(s:String):String | |
{ | |
var appendedString:String; | |
appendedString = _bar + s; | |
return appendedString; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment