4DIS - JavascriptTutorial - Classes

From Unify Community Wiki
Jump to: navigation, search

Javascript Classes

4DIS - JavascriptTutorial - Back


Creating own classes :

<javascript>

class MyClass {

   function MyClass ( ) { }
   
   // ...

}

// Variables...

class MyClass {

   function MyClass ( ) { }
   
   var a : int = 5;
   var b : float = 2.5;

}

// Functions...

class MyClass {

   function MyClass ( ) { }
   
   var a : float = 2.5;
   var b : float = 7.5;
   
   function MyFunction ( )
   {
       return a * b;    
   }

}

</javascript>


Using own classes :

<javascript>

var mc : MyClass = new MyClass ( );

print ( mc.MyFunction ( ).ToString ( ) );

</javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox