Dear all,
I have the following problem. I wrote some code where I overload various operators (+ – * /) and I would like to keep track of all the operations done. I initialize a session by creating a global variable, "myglobal", which will help me in this endeavor.
global myglobalmyglobal=containers.Map();
Then the typical overloaded operation does the following
function c=plus(a,b) c=myobject(a.x+b.x); push(c)end
where the push function above roughly looks like this
function push(c) global myglobal Count=myglobal.Count+1; myglobal(Count)=c.x;end
I know using global variables is bad and I would like to get rid of the global variable. Any suggestion on how to go about this?
Thanks,
Pat.
Best Answer