Nice TWiki > Doc > CodeExamples > ObjinstBeginnerExample (r1.1) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
/* Please try the BeginnerExamples before the NoviceExamples
To compile:
   nicec --sourcepath=.. -a objinst.jar objinst
To run:
   java -jar objinst.jar 1000000
*/


import methcall; 

void main(String[] args){
   let n = toSingleInt(args);

   var toggle = new Toggle();
   for(var i=0; i<5; i++) println( toggle.activate().value() );
   for(var i=0; i<n; i++) toggle = new Toggle();

   print('\n');

   var ntoggle = new NToggle(toggleTrigger: 3);
   for(var i=0; i<8; i++) println( ntoggle.activate().value() );
   for(var i=0; i<n; i++) ntoggle = new NToggle(toggleTrigger: 3);
}


/* Notes - language
Compare with Java at the "Win32 Language Shootout"

   import methcall; 
Reuse the implementation of class Toggle & NToggle and the
function toSingleInt that were defined in package methcall.
Assume the packages are in \project\methcall and \project\objinst 

Note that the whole package methcall is imported.
*/
-- IsaacGouy - 27 Aug 2003

Topic ObjinstBeginnerExample . { Edit | Attach | Ref-By | Printable | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }
Revision r1.1 - 27 Aug 2003 - 00:28 GMT - IsaacGouy
Parents: WebHome > CodeExamples
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.