What is the inheritance hierarchy?

Inheritance hierarchy is a singly rooted tree structure for organizing classes. In .NET, the inheritance hierarchy refers to the organization of classes in a hierarchical structure where derived classes inherit behaviors and characteristics from their base classes. This hierarchy allows for code reuse, abstraction, and polymorphism. At the top of the hierarchy is the Object … Read more

What is inheritance?

Inheritance is a method for creating hierarchies of objects wherein one class, called a subclass, is based on another class, called a base class. In the context of .NET programming, inheritance is a fundamental object-oriented programming (OOP) concept that allows a class (called the derived or child class) to inherit properties, methods, and other members … Read more

What is the extension method for a class?

The extension method is used to add new methods in the existing class or the structure without modifying the source code of the original type. Special permission from the original type or re-compiling it isn’t required. In .NET, an extension method is a static method that adds new functionality to an existing type without altering … Read more

What is a base class and derived class?

The base class is a class whose members and functions can be inherited, and the derived class is the class that inherits those members and may also have additional properties. In .NET programming, a base class and a derived class are fundamental concepts in object-oriented programming (OOP). Here’s a breakdown of each: Base Class: A … Read more

What is the difference between the While and For loop? Provide a .NET syntax for both loops.

The For loop provides a concise way of writing the loop structure, but the While loop is a control flow statement that allows repetitive execution of the code. Initialization, condition checking, iteration statements are written at the top of the For loop, but only initialization and condition checking is done at the top of the … Read more