Template:Nasal Constructor inline: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
   # constructor, for making new objects
   # constructor, for making new objects
   new: func() {
   new: func( {{{2|arg...}}} ) {
   # creates a temporary object that inherits from {{{1|myClass}}}
   # creates a temporary object that inherits from {{{1|myClass}}}
   var obj = { parents:[ {{{1|myClass}}} ] };
   var obj = { parents:[ {{{1|myClass}}} ] };
Line 6: Line 6:
   # do any other set up here, such as for example
   # do any other set up here, such as for example
   obj.message = "Hello World";
   obj.message = "Hello World";
    
 
   {{{3|print("Creating new object"); }}} 
   # return the object to the caller
   # return the object to the caller
   return obj;
   return obj;
   },
   },

Navigation menu