What is a class? What is a Base Class?

A class is an organized store-house in object-oriented programming that gives coherent functional abilities to a group of related code. It is the definition of an object, made up of software code. Using classes, we may wrap data and behavior together (Encapsulation). We may define classes in terms of classes (Inheritance). We can also override the behavior of a class using an alternate behavior (Polymorphism).

A Base Class is a class that is inherited by another class. In .NET, a class may inherit from only one class.

What is Encapsulation? Explain in Brief.

Encapsulation – is the ability of an object to hide its data and methods from the rest of the world. It is one of the fundamental principles of OOPs.

Say we create a class, named Calculations. This class may contain a few members in the form of properties, events, fields or methods. Once the class is created, we may instantiate the class by creating an object out of it. The object acts as an instance of this class, the members of the class are not exposed to the outer world directly, rather, they are encapsulated by the class.
Public class Calculations
private void fnMultiply(int x, int y)
return x * y;

Calculations obj;
int Result;
Result = obj.fnMultiply(5,10);

How to prevent inheritance of a class in .NET?

Use the keyword NotInheritable in VB.NET and sealed in C#.

How to prevent overriding of a class in .NET?

Use the keyword NotOverridable in VB.NET and sealed in C#.

What is encapsulation?

Encapsulation is the OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.

What is the use of a private constructor?

A private constructor may be used to prevent the creation of an instance for a class.

Hows method overriding different from overloading?

When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.