$の使い方

AS3の命名規則で"$"を使うことが出来るんだけど、具体的にいつ使えばいいのか長らく謎だった。けど、「Flex SDK coding conventions and best practices」にそれらしい記述を発見。

曰く

If a class overrides a method and wants to continue to expose the base method, it should do so by implementing a method whose name is the base name with a $ prepended. This method should be marked final and should do nothing more than call the supermethod.
mx_internal final function $addChild(child:DisplayObject):DisplayObject
{
    return super.addChild(child);
}
だそうです。

そう、つまり、「基底クラスのメソッドをオーバーライドしつつ基底クラスの基底メソッドを使いたい」ときに「$マーク付けてfinalにする」んだよ。と言っている気がする。多分。

Trackback

http://memo.kappa-lab.com/mt-tb.cgi/233

Leave your comment :

(いままで、ここでコメントしたことがないときは、コメントを表示する前に承認が必要になることがあります。そのときはしばらくお待ちください。)




RSS + Contuct

  • rss
  • email

Credit

Copyright (C) 2007 kappa-lab.com.
All Rights Reserved.