OOPs INTERVIEW QUESTION & ANSWERS
26. |
What is the difference between Shadowing and Overriding? |
|
- Overriding redefines only the implementation while shadowing redefines the whole element.
- In overriding derived classes can refer the parent class element by using "ME" keyword,
but in shadowing you can access it by "MYBASE".
|
27. |
How a base class method is hidden? |
|
Hiding a base class method by declaring a method in derived class with keyword new. This will override the base class method and old method will be suppressed. |
28. |
Define ADT? |
|
An ADT is a set of data and a set of operations on that data. ADTs enable us to
define new language types by hiding internal data and state behind a well-defined interface. This interface presents the ADT as a single atomic unit. |
29. |
What is an interface class? |
|
It is an abstract class with public abstract methods all of which must be implemented in the inherited classes. |
30. |
What is static constructor? |
|
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced. |