Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Announcements
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rating: Thread Rating: 10 votes, 4.60 average. Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:21 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.