quick oops question
-
I am new to object oriented. With classes and objects, what is the equivalent for global varialbe. Suppose I have different forms...each forms has its own class. If I want to decalre a variable that is common to all forms, so that I can change and retrieve the value of that variable in any form I want, how do I do that. Thanks.
-
I am new to object oriented. With classes and objects, what is the equivalent for global varialbe. Suppose I have different forms...each forms has its own class. If I want to decalre a variable that is common to all forms, so that I can change and retrieve the value of that variable in any form I want, how do I do that. Thanks.
In C# declare the variable as a static member of one of the classes. It can be accessed by classname.variable name in the other classes.
I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
-
I am new to object oriented. With classes and objects, what is the equivalent for global varialbe. Suppose I have different forms...each forms has its own class. If I want to decalre a variable that is common to all forms, so that I can change and retrieve the value of that variable in any form I want, how do I do that. Thanks.