20,741
edits
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
# constructor, for making new objects | # constructor, for making new objects | ||
new: func( {{{ | new: func( {{{signature|arg...}}} ) { | ||
# creates a temporary object that inherits from {{{ | # creates a temporary object that inherits from {{{name|myClass}}} | ||
var {{{ | var {{{temporary|obj}}} = { {{Nasal Inherit from|{{{name|myClass}}} }} }; | ||
# do any other set up here, such as for example | # do any other set up here, such as for example | ||
{{{ | {{{temporary|obj}}}.message = "Hello World"; | ||
{{{ | {{{body|print("Creating new object/instance of type/template:{{{name|myClass}}}"); }}} | ||
# return the object to the caller | # return the object to the caller | ||
return {{{ | return {{{temporary|obj}}}; | ||
}, | }, | ||