OOPs INTERVIEW QUESTION & ANSWERS
61. |
What are the types of polymorphism? |
|
There are two types of polymorphism are : - Compile time polymorphism
- Runtime polymorphism
|
62. |
Define message passing? |
|
The process by which an object sends data to another object or asks the other object to invoke a method. |
63. |
What are the difference between const and readonly? |
|
- A const can not be static, while readonly can be static.
- A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.
- A const's value is evaluated at design time, while a readonly's value is evaluated at runtime.
|
64. |
Can you override private virtual methods? |
|
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access. |
65. |
What is a basic difference between the while loop and do while loop? |
|
The while loop tests its condition at the beginning, which means that the enclosed set of statements run for zero or more number of times if the condition evaluates to true. The do...while loop iterates a set of statements at least once and then checks the condition at the end. |