Skip to content

Instantly share code, notes, and snippets.

@takimo
Created November 1, 2011 00:04
Show Gist options
  • Select an option

  • Save takimo/1329462 to your computer and use it in GitHub Desktop.

Select an option

Save takimo/1329462 to your computer and use it in GitHub Desktop.
getter/setter
package{
public class Sample{
// 仮でつけた名前なのでなんでもいいですよ
// privateな変数名の一番最初にアンダースコアをつけるのは他の変数と区別するための慣習です
private _targetArray:Array;
public function Sample(){
}
// getter
// getほにゃららのようなメソッド名にする
public function getTargetArray():Array{
return this._targetArray;
}
// 外部から値を挿入したいなら
// setほにゃららのようなメソッド名にする
public function setTargetArray(targetArray:Array){
this._targetArray = targetArray;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment