C#.NET INTERVIEW QUESTION & ANSWERS
81. |
What is Method overloading? |
|
Method overloading occurs when a class contains two methods with the same name, but different
signatures.
|
82. |
What does a break statement do in switch statements? |
|
The break statement terminates the loop in which it exists. It also changes the flow of the execution of a program. In switch statements, the break statement is used at the end of a case statement. The break statement is mandatory in C# and it avoids the fall through of one case statement to another.
|
83. |
How is method overriding different from method overloading? |
|
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class. |
84. |
How do I declare a pure virtual function in C#? |
|
Use the abstract modifier on the method. The class must also be marked as abstract (naturally). Note that abstract methods cannot have an implementation (unlike pure virtual C++ methods). |
85. |
Can we have shared events? |
|
Yes, you can have shared event's note only shared methods can raise shared events. |