Kalpana Kalpana (Editor)

Nullary constructor

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In computer programming, a nullary constructor is a constructor that takes no arguments. Also known as a 0-argument constructor.

Contents

Object-oriented constructors

In object-oriented programming, a constructor is code that is run when an object is created. Default constructors of objects are usually nullary.

Algebraic data types

In algebraic data types, a constructor is one of many tags that wrap data. If a constructor does not take any data arguments, it is nullary.

References

Nullary constructor Wikipedia