Thread: Gs3
View Single Post
  #11  
Old 06-16-2013, 11:23 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Quote:
Originally Posted by Twinny View Post
My desires:

Constructors (being able to overload would also be awesome but perhaps taking it too far)
PHP Code:
class Test {
  var 
myname string;
  var 
myage int;

  function 
Test(mynamestring) {
    
this.myname myname;
  }
  
//Because overloading is fun
  
function Test(myname stringmyage number) {
    
this.myname myname;
    
this.myage myage;
  }

  function 
echoValues() : void {
    
printf("My name is %s and my age is %i"this.myname, (this.myagethis.myage "Unknown"));
  }
}

function 
onCreated() : void {
  var 
TestObj Test = new Test("Twinny"25);
  
TestObj.echoValues(); 
I know getters/setters will be on the way but this just seems more natural.

I added that printf as it will fail since it's not being referenced in that class(see: extern). For this, perhaps being able to simply prepend global. to global functions would be better. On a similar note, i've not tried but i hope we could use something like super.whatever to access base class items we inherited from :o
This.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote