# Private Class Not So Private?

**URL:** <https://forum.kirupa.com/t/private-class-not-so-private/208203>\
**Category:** flash\
**Created:** [November 26, 2006, 10:06am UTC](https://forum.kirupa.com/t/private-class-not-so-private/208203 "2006-11-26T10:06:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewfitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/andrewfitz/32/765_2.png) [@andrewfitz](https://forum.kirupa.com/u/andrewfitz)\
**Post date:** [November 26, 2006, 10:06am UTC](https://forum.kirupa.com/t/private-class-not-so-private/208203/1 "2006-11-26T10:06:40Z")

</div>

Okay so you’ve got your private vars in your AS2 Class, you think they’re all safe right? Wrong.

Doing a trace(MyClass.myvar); will spit out an error that the var is private and you can’t touch it.

But a trace(MyClass[“myvar”]); will work perfectly fine. You can use it normal, without any setters getters outside the class.

Is there a way to protect against this? I think this is a huge security flaw. I know it’s simple OOP, but a private var in an object should have rules.
