1. Question:Define Inheritance and Polymorphism. 

    Answer
    Inheritance:When a new class is inherited from another class to extend or customize the original class, the new class is called the inheritance of the original class.Polymorphism: Polymorphism, in C#, is the ability of objects of different types to provide a unique interface for different implementations of methods.

    1. Report
  2. Question:Define Delegates and Events. Define Func and Action Delegates. 

    Answer
    Delegates: A delegate dynamically wires up a method caller to its target method. There  are two aspects to a delegate: type and instance.Events: Events are pairs of methods, appropriately decorated in IL to tie them together and let languages know that the methods represent events. The methods correspond to add and remove operations.

    1. Report
  3. Question:Static vs Non static members. 

    Answer
    1. static members are one per class but non-static members are one per instance.
    2. static members are accessed by their class name which encapsulates them, but non-static members are accessed by object reference.
    3. static members can't use non-static methods without instantiating an object, but non-static members can use static members directly.
    4. static constructor is used to initialize static fields, but for non-static fields normal instance constructor is used.

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd