Private Square Bracket Syntax

  1. package {
  3.     import flash.display.Sprite
  5.     public class Test extends Sprite {
  7.         private var _test:String = "private square brace syntax";
  8.         public function Test(){
  9.             trace(this["_test"]);
  10.         }
  11.     }
  12. }

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?)

This entry was posted in Uncategorized and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted March 5, 2010 at 2:03 am | Permalink

    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.

Post a Comment

Your email is never published nor shared. Required fields are marked *