Hi everyone, I'm new to C++ programming, I'm sure I'll be asking many, many, MANY questions regarding this language, and would really appreciate your support!
Anyway, here's my first question - what is the void keyword meant for? I see it used usually as an immediate subsequent line after a string of code typed, for instance like this snippet -
void literally means nothing. It is usually used as a function or method return type, when the function isn't supposed to return anything. In the second method you typed out, with the void keyword, it is setting a value, and nothing needs to be returned. The first one has int, because it is returning an int, (specifically, the screen width).
this-> refers to the calling object. For the following example, I will assume the methods you posted are part of a screen class with an int p_screenwidth variable :
1 2 3
screen example;
example.setScreenWidth(12); //when it calls the method, "this->" is the same as "example"
//"this->" is not explicitly necessary in this case