Write variable from other function
Dicebot
public at dicebot.lv
Fri Feb 28 06:42:34 PST 2014
On Friday, 28 February 2014 at 14:15:17 UTC, Suliman wrote:
> I remember (if I now mistake) that there is way to get access
> to vars from other class in way like MyClass2.var = 2 but
> probably I am wrong
You want static variables, either in form of global variables
(discouraged) or static class fields:
class MyClass
{
static int var; // note static!
}
You can't access local variables of other functions because they
are, well, local.
More information about the Digitalmars-d-learn
mailing list