|
INTERVIEW QUESTIONS
MICROSOFT
C#
DETAILS
Question: 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: Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in it.
|
|
|
Category |
C# Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 8600 users |
Added on |
7/28/2011 |
Views |
74933 |
Rate it! |
|
|
Question:
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:
Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in it. Source: CoolInterview.com
compiler provides default constructor which is also called zero argument constructor if there is no constructor available. But when any argument based constructor is present and we want zero argument constructor, then explicitly programmer has to write the constructor. Source: CoolInterview.com
Answered by: Manjushree | Date: 9/9/2010
| Contact Manjushree
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
When you inherit a protected class-level variable?Who is it available to?
|
View Answer
|
|
Does C# support multiple inheritance?
|
View Answer
|
|
How do you inherit from a class in C#?
|
View Answer
|
|
What is an abstract class?
|
View Answer
|
|
What does the keyword virtual mean in the method definition?
|
View Answer
|
|
How's method overriding different from overloading?
|
View Answer
|
|
What's the top .NET class that everything is derived from?
|
View Answer
|
|
Describe the accessibility modifier protected internal.
|
View Answer
|
|
Are private class-level variables inherited?
|
View Answer
|
|
When you inherit a protected class-level variable? Who is it available to?
|
View Answer
|
|
Does C# support multiple inheritance?
|
View Answer
|
|
How do you inherit from a class in C#?
|
View Answer
|
|
What's the implicit name of the parameter that gets passed into the class' set method?
|
View Answer
|
|
Is it mandatory to implement all the methods which are there in abstract class if we inherit that abstract class..?
|
View Answer
|
|
What is the difference between const and static read-only?
|
View Answer
|
|
How to fill datalist usinf XML file and how to bind it,code behind language is c#
|
View Answer
|
|
WHAT IS THE ADVANTAGE OF SERIALIZATION?
|
View Answer
|
|
How we hand sql exceptions? What is the class that handles SqlServer exceptions?
|
View Answer
|
|
What is indexer? where it is used plz explain
|
View Answer
|
|
can we inherit the java class in C# class,how?
|
View Answer
|