Private Square Bracket Syntax

package {
	
	import flash.display.Sprite
	
	public class Test extends Sprite {
		
		private var _test:String = "private square brace syntax";
		public function Test(){
			trace(this["_test"]);
		}
	}
}

It’s important to note that square bracket syntax works with private vars… tomorrow I’ll post a class I wrote that makes use of this technique to preserve encapsulation in an interesting way…

(auto-post didn’t post this one yesterday for some reason… weird wordpress bug maybe?)

1 comment

  1. I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Leave a Reply

Your email address will not be published. Required fields are marked *