4DIS - JavascriptTutorial - Classes

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
 
}
 
}
  
 
+
// Variables...
  
 
class MyClass
 
class MyClass
Line 24: Line 24:
 
     var a : int = 5;
 
     var a : int = 5;
 
     var b : float = 2.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>
 
</javascript>

Revision as of 08:56, 30 October 2011

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>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox