WordGarden.io
Back to search

constructor

B1
noun

Pronunciation

UK

  • /kənstrˈʌktə/

US

  • /kənˈstrəktər/

Description

A constructor isn’t just someone who builds houses. It can mean the person or company responsible for building a project—especially in formal writing about construction. In programming, it means a special method that creates a new object and sets it up.

The word comes from the Latin construere, meaning "to build together." In construction, the constructor brings together workers, tools, and materials to turn plans into a real structure. In programming, the constructor runs when an object is created and gives it its first values. You might read, "The constructor is responsible for site safety," or "This class’s constructor sets a default role for new user profiles."

Examples

  1. 1

    Java objects

    In Java, the constructor runs when you create a new object.

  2. 2

    Overloaded constructors

    This class has two constructors: one with no arguments and one that takes a name.

    • Phrase

      with no arguments

      without any input values

  3. 3

    Inheritance

    The child class must call the parent constructor first.

  4. 4

    Access control

    We made the constructor private so users can't create the class directly.

    • Domain

      in programming, private means only usable inside the class

  5. 5

    Setup code

    Most of the setup code belongs in the constructor, not in every method.

Forms and spellings

2 forms open this card.

Main spelling

  • constructornoun

Forms

  • constructorspluralnoun