How to Ignore the Constructor When Extending a Class

As we all know, if you don’t call super() in your constructor’s code, the Flash compiler will automatically append it to your constructor’s code.

Turns out, this isn’t entirely true. The compiler only adds super() if it doesn’t see it written out in the constructor. It makes no distinction whether you actually call it or not. Here is a simple little trick if you want to completely hop over calling super() when creating a sub-class.

If you want more reading on the matter, this information was taken from a forum thread by Krilnon over at the Kirupa forums.

But remember, as I brought up in the forum thread linked to above:

In my opinion, this is pure evil! No good can come of not calling constructors, none at all…

So use with caution!

Post a comment

All comments are held for moderation; Markdown and basic HTML formatting accepted.

(required)
(required, not published)
(optional)