The material for static classes states that you cannot instantiate a static constructor. It also says that when instantiating a new object you use the new keyword.
im a bit confused. Since you cannot instantiate a static constructor, but yet i can use:
Forest f = new Forest();
In order to trigger one. I have re-read the material and even re done the entire class section of lessons, but I still find myself unable to understand the difference. How is it that I cannot instantiate a static constructor, but at the same time I have to in order to trigger one?
Docs are pretty helpful
A static constructor is called automatically. It initializes the class before the first instance is created or any static members declared in that class (not its base classes) are referenced. A static constructor runs before an instance constructor
The example they provide should shed some light. But in general, something that is “static” has less to do with object instances and more to do with the general class itself. Meaning, there is no concept of different “instances” of static things. They can be called without instantiating the class itself. I don’t know what lesson you’re referring to so I can’t comment directly to it.
ah right, so its just saying but instantiating an object it’ll still automatically call a static constructor as well. Now its clicking thank you!