In this tutorial, I am going to explain you some Interview Questions and Answers on Oops. Oops is mostly asked topics during Interview.


Here I am going to write some Interview Questions and Answers on Oops. Here it is.

Interview Questions

Interview Questions and Answers on Oops- Part 1

Q) How to inherit a child class from a parent class in C#?

A) Place a colon and then the name of the parent class.


class childclass : BaseClass

Q) How to prevent a class from being inherited by another class? If yes then which keyword makes it possible.

A) We can prevent a parent class from being inherited by another class.

Q) Suppose that I want to allow a class to be inherited, but want to prevent the method from being over-ridden. How is it Possible?

A) Mark the class as public and make the method sealed.

Q) Explain abstract class?

A) An abstract class is a class in C# that can’t be instantiated. An abstract class can have both abstract methods and Concrete method. An abstract class work as a blueprint for a class without any implementation.

Q) List the situation when we actually need Abstract Class?

A) Here are the situations when we need Abstract Class:

  •  We should use an abstract class, when we want to move the common functionality of two or more related classes into a base class and when we don’t want to create an object of that base class.
  • When at least one of the methods in the class is abstract.

Q) Explain Interface?

A) Interface in C# is like a Contract that enforces its client (Class) to follow all protocols. This contract ensures that the class will implement all methods, properties, events defined in the interface. The interface contains only the signature, not the implementation the implementation. Since C# does not support multiple inheritances, so Interface is a way to achieve multiple Inheritances in C#. The interface is used to define what to do not how to do. The “how” part is defined by the class that implement the interface.

You can learn more on Interface here.

Q) Is it possible to specify the access modifiers for methods inside the interface?

A) No, since they all must be public, and are therefore public by default.

Q) Is it possible to inherit multiple interfaces?

A) Yes. .NET does support multiple interfaces inheritance.

Q) What’s the difference between an interface and abstract class?

A) Here is the difference:

  • In interface all methods are abstract means there is no implementation whereas in abstract class some method can be concrete.
  • In Interface all methods no access modifiers are allowed whereas an abstract class may have access modifiers.

You can learn more on Abstract Class here.

Q) What is the difference between a Struct and a Class?

A) Here is the difference:

  • Structs are value-type variables and Classes are a reference type.
  • Another difference is that structs can not be inherited whereas classes can be inherited by a class.

Hope this post about Interview Questions and Answers on Oops is useful for you. We will discuss more on it in later sections.

Interview Questions

Thank You