new >>-new-+---------------+--------------------------------------->< | +-,---+ | | V | | +-(----arg-+--)-+ Returns a new instance of the receiver class, whose object methods are the instance methods of the class. This method initializes a new instance by running its [init] methods. (See .) [new] also sends an [init] message. If you specify args, [new] passes these arguments on the [init] message. Class class - new method /* new method example */ a = .account~new /* -> Object variable balance=0 */ y = .account~new(340.78) /* -> Object variable balance=340.78 */ /* plus free toaster oven */ ::class account subclass object ::method init /* Report time each account created */ /* plus free toaster when more than $100 */ Expose balance Arg opening_balance Say "Creating" self~objectName "at time" time() If datatype(opening_balance, "N") then balance = opening_balance else balance = 0 If balance > 100 then Say " You win a free toaster oven" |