.get() returns a ref to x. This is set to 15 which means that x is set to 15. Any change to the value of a ref changes the data to which the ref refers.
The get() member functions return a reference to your class' data member (x). The non-const get() version allows the class data member to be modified by assigning a different value to it.
@seeplus @Furry Guy
thanks for your replies.