Object Oriented Programming with M


 * OO Support Library
 * Definition of tWidget


 * SAMPLE CODE USING OBJECT ORIENTED APPROACH
 * Main function below
 * Main function below
 * 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