+ 1
Classes and instantiating classes c#
Hi - I have a question on creating classes and methods.. In terms of the static notation when it comes to creating a method (private static void ) is static only used in console applications? And can they be used in Windows Form Apps as well.. and also in terms of creating a new class with method would can static be used to then just call the calls in the main method instead of instantiating the class as new in the main method ? I hope my question makes sense Thanks Trey
1 Antwort
+ 1
Yes. Static is not bound to Console. It is used in winforms as well.
Hope you have access to a computer. Download visual studio community version. It is free. And try it yourself.
Classes can be instantiated anywhere. In simple programs it will be in the main method, but in more complex programs it also eill be in other classes.
For example
You can create a dog in the main method.
And have a leash created in the dog class.