Nullable type in C++

Sometimes we create an object which contains no valid data. We often a associate a flag or a special value, which decides the validity of the data. For example,

  • a pointer with value nullptr is a pointer that points to no location.
  • an id type with an allowed value of 0, which says the id is invalid if 0 or it’s a valid if more than 0.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store