Skip to main content

Questions tagged [constructors]

Filter by
Sorted by
Tagged with
9 votes
4 answers
2k views

What are the approaches of protecting against partially initialized objects?

An object is partially initialized if the program execution didn't exit their constructor yet. Usually the programmer is responsible for not leaving partially initialized objects in unwanted places ...
user23013's user avatar
  • 2,740
4 votes
4 answers
366 views

Options of the relationship between classes and constructors

Given a class and its constructor to be defined, what are some options of where to put them logically relative to each other? What are the pros and cons of each of them? For example, is a class and ...
user23013's user avatar
  • 2,740
5 votes
2 answers
244 views

Why do languages differ about when `super` must be called in a constructor?

Many languages require you to call super before setting your own properties, like in TypeScript: ...
Bbrk24's user avatar
  • 9,277