Object-oriented programming (OOPs) Question:

Download Job Interview Questions and Answers PDF

What are Constructors?

OOP Interview Question
OOP Interview Question

Answer:

Constructors are used for initializing the members of a class whenever an object is created with the default values for initialization.

If no constructor defined then the CLR will provide an implicit constructor which is called as Default Constructor.

A class can have any number of constructors provided they vary with the number of arguments that are passed, which is they should have different signatures.

Constructors do not return a value
Constructors can be overloaded

Download OOP Interview Questions And Answers PDF

Previous QuestionNext Question
When to Use Abstract Classes and When Interfaces.What are the various types of Constructor