I am new to C++ and trying to understand a code related to OpenCV. It has a class as follow:
class Settings
{
public:
Settings() : goodInput(false) {}
enum Pattern { NOT_EXISTING, CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
enum InputType { INVALID, CAMERA, VIDEO_FILE, IMAGE_LIST };
.
.
.
.
}
what does Settings() : goodInput(false) {}
means here. I don't think it is a constructor. Explain this please.
It is indeed a constructor. What you see after :
is called initializer-list and it initializes values before entering the curly brackets.
You should also know that member variables of a class are always initialized before entering the constructor body. If you don't mention a member variable in the initializer list, it will be default initialized.