A(n) ___________ is a special method in OOP that is automatically invoked when an object is created.

  • Constructor
  • Destructor
  • Getter
  • Overrider
A constructor is a special method in object-oriented programming that is automatically called when an object of a class is created. Its primary purpose is to initialize the object's state, allocate memory, and perform any necessary setup operations. Constructors typically have the same name as the class they belong to and can have different forms such as default constructors, parameterized constructors, and copy constructors.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *