The reason is that _Display will be used probably after its construction.
So you pass the byte during construction, and afterwards the value is available during the object's lifetime.
In C you probably will do this by:
- Passing the variable (byte DisplayType) in each function where the value is needed (you can use this way in C++ too but it's cumbersome in both C/C++ to pass the variable in all functions needed).
- Storing it in a global variable (static for that .c file); this is the typically C method.
* Added explanation *
Such a variable is called class variables and are mostly made private. The reason is that other objects cannot change the value directly. The only way to change a variable is:
- By initializing it in the class constructor (like in your example).
- Within the class itself (by any method).
- By a typical Set method (like SetDisplayType). This method can check if the value passed is within a range, and there is only one entry point in this class to change it.
To retrieve the value, typically a GetDisplayType method should be created which is public. The variable itself is private.