A constructor
Firstly, I would like to focus on a constructor. So what is it ? Constructor is a special non-static member function of a class that is used to initialize objects of its class type. Frankly… during creating an object there is a default constructor which you can’t see in IDE but you have a possiblity to modify. You can meet constructor e.g during click right button on your mouse. You see a menu created by a constructor.
Let’s write a code using a constructor in your project. On the start create a class:

It is a high time to modify a constructor of the ‘class Application’. Recently I wrote a post where to set a method and I want to use this tip here.
Name of a constructor is the same like a name of a class. When you run a program you will have… ? What do you think ? Remember: a constructor will be created when you make a class with an object. Just think for a moment.
You will get:
Let’s add a few lines of code (an information):
If you would like to run the program right now, you will have rubbish on your terminal. Why ? Because you haven’t set a value of variables yet. It could be great to correct these mistakes. You can set a value to every single variable, even if they are in ‘private:’ field because you are going to do inside a specific function (in this case: constructor).
Values were set after creating a class. Sometimes you have to define during creating a class. In this situation you can do it in this way:
Does it work ? Let’s check:
If constructor is a function, so can I give an argument ? Of course, it is possible and I am going to show you.
This is the way to give any argument to constructor.
More informations about constructor
