C# provides a default constructor for me. I write a
constructor that takes a string as a parameter, but want to
keep the no parameter one. How many constructors should I write?
Answer Posted / tsahi
that depends on weather you are writing a class or a struct.
in a class, the first answer given is correct (i.e. two
constructors). in a struct, you cannot write a default
constructor, and you will always have the automatically
generated one, in addition to any other constructor you may
write by your self.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Is c# good for games?
What is thread in c#?
Why do we use Design Pattern in C#?
How can it prevents DLL Hell assembly versioning in .NET?
What is the usage of transponders?
Does google use c#?
How do I create a single-file assembly?
What are Uses of CLR
Explain about finalize method?
How more than one version of an assembly can keep in same place?
How do I open the console window?
Explain more on CLR
How do you convert byte array to hexadecimal string, and vice versa?
What is Custom attribute? How to create? If I'm having custom attribute in an assembly, how to say that name in the code?
What is native image generator (ngen.exe)?