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


Please Help Members By Posting Answers For Below Questions

What is the signature of a method?

483


Can you change the value of a constant filed after its declaration?

517


What is the difference between int and int in c#?

489


What is dictionary class in c#?

471


What is the use of thread join in c#?

495






What is ulong in c#?

569


What are the access modifiers in c#?

497


Why we use get set in c#?

495


What are the steps to make an assembly to public?

498


How does bitwise xor work?

467


What does public mean in c#?

513


What is thread safe in c#?

490


Name some properties of thread class.

549


What is helper method in c#?

492


Can a abstract class have a constructor?

464