Now we have a class that has a public function called “PrintAndAdd” and a private member variable called “memberVariable”. For more information on public, private and protected qualifiers see Encapsulation.
Since we’ve declared some new stuff in our header file, we should implement it in the code file:

Now the constructor makes sure that all of it’s (one) member variables are initialised and we have implemented a function which, as you might have guessed, prints out the value of the member variable and then adds to it.