Do I always have to use constructor in C# -
Do I always have to use Constructor in C #?
I am working on some examples. They use the constructor, I'm not sure that I understand it, because I think I do not have to use the constructor.
If a constructor is not defined, then the default constructor will automatically generate Have been for you Generated code is similar to writing: If you want to start the parameter, or member You have to write your own if you inherit the parameter with a base class, then you have to write one. Since you are just learning about the constructor, you do not have to worry about it yet, but it is something to keep in mind. Note that if you have any constructor (even one with a parameter), you need to explicitly define it if you still have One without parameters Here is the documentation for a default constructor:
Public MyClass (): base () {}
Comments
Post a Comment