OOPs Interview Question and Answers
51. |
What are the restrictions of static methods? |
|
- Static methods can only call other static methods.
- Static methods can only access static data.
- Static methods can not refer to this or base in any way.
|
|
|
52. |
When to use Inheritance? |
|
- Inheritance is suitable where the following situations arise.
-
Similarities, Extension, Relationship, Generalization, Specialization, Combination
|
|
|
53. |
What are the characteristics of abstract class? |
|
- It cannot be instantiated directly.
- It can have abstract members.
- We cannot apply a sealed modifier.
|
|
|
54. |
How to implement Inheritance? |
|
To implement the inheritance, the following are the steps:- Declare a base class
- Inherit the derived class from the base class.
- Declare the new class to make use of the both above classes.
|
|
|
55. |
What is the advantage of using System.Text.String Builder over System.String? |
|
-
String Builder is more efficient in the cases, where a lot of manipulation is done to the text.
- Strings are immutable, so each time it is being operated on, a new instance is created.
|
|
|
123456789101112
Page 11 of 12