OOPs INTERVIEW QUESTION & ANSWERS
66. |
Why is the virtual keyword used in code? |
|
The Virtual keyword is used in code to define methods and the properties that can be overridden in
derived classes. |
67. |
What is event? |
|
- An event is an action performed based on another method of the program.
- An event is a delegate-type class member that is used by an object or a class to provide a notification to other objects that an event has occurred.
-
An event can be declared with the help of the event keyword.
|
68. |
What is the difference between early binding and late binding? |
|
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding. |
69. |
What are the features of abstract class? |
|
- Abstract class can't be static.
- Abstract class is used for inheritance.
- Abstract class can't be sealed.
- Abstract or virtual members can't be private, as we can't override it.
- Abstract class can be inherited from an abstract class but the methods in the base class have to be declared abstract.
|
70. |
What is sealed class? |
|
Sealed classes are those classes which can not be inherited and thus any sealed class member can not be derived in any other class. A sealed class cannot also be an abstract class. |