The variable name in the parameter to the print() function is NOT the same as the variable name declared in the class -- the name in the parameter will override (hide) the one declared in the class.
If you want to use the variable declared in the class then do not specify a parameter to print(). Just simply this: void print()