Because you aren't returning an int, so there is no reason to. The void data type is used when the function returns nothing. If you're passing data to a class to store, then you would return void because the class doesn't need to return any data. Or if you have a function that just outputs a line of text... it doesn't need to return anything.
Void can also be specified as a pointer which can point to any memory address regardless of the value. It also can be used to implicitly specify that there is no arguments being passed to a function, but is not required in C++ as it is in C.
Code:
// Example 1
void myClass::setData(int d) {
this->data = d;
return; // This line is optional
}
// Example 2
int data = 5;
int *myIntPtr = &data;
void *myVoidPtr = myIntPtr;
char info = 'A';
char *myCharPtr = &info;
myVoidPtr = myCharPtr;
// Example 3
int myClass::getData(void) {
return this->data;
}