C# Interview Question and Answers
16. |
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. |
|
|
17. |
What’s an abstract class? |
|
A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it's a blue print for a class without any implementation. |
|
|
18. |
What’s an interface class? |
|
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
|
|
|
19. |
What’s the difference between an interface and abstract class? |
|
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.
|
|
|
20. |
What is the difference between System.String and System.StringBuilder classes? |
|
System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. |
|
|