Main » TERM » C »

Constructor Definition & Meaning

A constructor initializes an object in object-oriented programming. In many programming languages, a constructor has the same name as the class in which it creates the object. A programmer will typically declare a constructor within the class and then define the data types that make up the ensuing object.

Common types of constructors

Default constructors: what the program automatically inserts if no constructor is defined. This depends on the language, but typically a default constructor sets everything within the new object to its default value (such as 0) and defines no arguments. It can also set default parameters but is still considered a default constructor.

Parameterized constructor: has parameters which identify arguments once a new object is initialized. The program automatically calls a constructor, which a programmer designs with certain parameters.

Copy constructor: creates a new object by making a copy of a preexisting one. Typically these objects must be in the same class.

Conversion constructor: does not have a specific (explicit) declaration; instead, the program implies the declaration. If a constructor is only given one parameter, the program may convert an object to another class or type implicitly. This is also referred to as a converting constructor.

Move constructor: transfers a pointer to different data or assigns the data to another object, instead of using a copy constructor. The data type moves rather than being copied.

Texting & Chat Abbreviations

From A3 to ZZZ we list 1,559 text message and online chat abbreviations to help you translate and understand today's texting lingo. Includes Top... Read More »

Huge List of Computer Certifications

Have you heard about a computer certification program but can't figure out if it's right for you? Use this handy list to help you decide. Read More »

Computer Architecture Study Guide

Computer architecture provides an introduction to system design basics for most computer science students. Read More »

Network Fundamentals Study Guide

Networking fundamentals teaches the building blocks of modern network design. Learn different types of networks, concepts, architecture and... Read More »

The Five Generations of Computers

Learn about each of the five generations of computers and major technology developments that have led to the computing devices that we use... Read More »