flash - Templates for AS3 (like c++) -


How do I define templates as C ++ in AS3 ?; I have Map Class (2D Array) which I want to use again in all projects but cell data is a different category based on project or implementation;

There is a bunch of other reasons for sharing codes on different implementations, but I hope for some things like:

  map = new MyMap & lt; MyCell & gt; ();  

No matter if this is only 10 Flash: -P

Cheers, Chris

Post -text "itemprop =" text ">

are not templates, but using dynamic typing and classes can have enough value for your purpose.

You can create a class that takes the class and stores it as a frequency variable.

  class MyMap {var myClass: Class; Function mime map (c: class) {myClass = c; }}  

and after that you can feed that square ...

  map = new MyMap (MyCell);  

And then in ways, you can refer to that class.

  // anything anywhere within myMyD: object = new myClass (); // or var anything: object = myClass. SomeCachingSchemeStaticMethod (); // Whatever.  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -