OOPs questions Inheritance The process of sub-classing a class to extend its functionality is called Inheritance.It provides idea of reusability. Order of Constructor execution in Inheritance constructors are called in the order from the top to the bottom (parent to child class) in inheritance hierarchy. Order of Destructor execution in Inheritance The destructors are called in the reverse order, i.e., from the bottom to the top (child to parent class) in the inheritance hierarchy. What are Sealed Classes in C#? The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class) Can you prevent your class from being inherited by another class? Yes. The keyword “sealed” will prevent the class from being inherited. Can you allow a class to be inherited, but prevent the method from being over-ridden? Yes. Just leave the class publi...
I have never implemented Const or Readonly. What is their extra ordinary purpose?
ReplyDelete