Object Oriented Programming with M
From VistApedia
Revision as of 05:36, 1 December 2005 by 24.75.227.14 (talk)
;------------------------------------------ ;Main function below ;------------------------------------------ MyFunct() new Widget ;"will store all instances of object type Widget new tWidget set tWidget=$name(Widget) new pWidget1 ;"will store 1 instance of Widget set pWidget1=$$new^TMGOOL(tWidget,"constrWidget^TMGOOWG") new done set done=0 for do quit:(done) . new x,y . read "input x (enter to quit): ",x,! . if x="" set done=1 quit . read "input y: ",y,! . if y="" set done=1 quit . write "> ",x," * ",y,"= ",$$fn^TMGOOL(pWidget1,"Multiply",x,y),! . write "> ",x," / ",y,"= ",$$fn^TMGOOL(pWidget1,"Divide",x,y),! . new temp set temp=$$fn^TMGOOL(pWidget1,"Show",x) do delete^TMGOOL(pWidget1) write "That all folks!",! quit