What does it mean exactly that only one instance of a static cass can exist in a program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does it mean exactly that only one instance of a static cass can exist in a program?

2nd Nov 2016, 4:14 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar
3 Answers
+ 1
As far as I know you can not create an instance of a static class. Static classes do not contain any instance member properties or functions. So to make an instance would be pointless.
2nd Nov 2016, 4:24 PM
Florian Schwarzer
+ 1
Essentially a static class is a class you cannot instantiate, meaning you cannot use the 'new' keyword to create it. An example of a static class is the System.Math class int result = Math.Min(10, 5); A class like this is typically referred to as a Utility class. "Static Classes and Static Class Members (C# Programming Guide)" : https://msdn.microsoft.com/en-us/library/79b3xss3.aspx
3rd Nov 2016, 10:26 PM
Michael Dolence
0
thank you!
3rd Nov 2016, 7:19 AM
Benedek Máté Tóth
Benedek Máté Tóth - avatar