To prevent a class from being extended or a method from being overridden, we precede that class or method definition with the final attribute.

How it works?
To Final a class:
final public class A{

}

To Final a method:
public class A{
final public function A{

}

}

The final attribute is used for two reasons in ActionScript:

  • In some situations, final method execute faster than non-final methods. If you are looking to improve your application’s performance in every possible way, try making its method final.
  • Methods that are final help hide a class’s internal detail. Making a class or a method final prevents other programmers from extending the class or overriding the method for the purpose of examining the class’s internal structure. Such prevention is considered one of the ways to safeguard an application from being maliciously exploited.
  • Spread the love