In chapter 8.4, we create a class called XYPoint to be used to store the coordinates for the Rectangle class.
I'm having trouble understanding the concept behind how this works, and more trouble understanding why you would want to do it like this. Why create a class, and put it inside another class to store information that you could inside the Rectangle class in the first place?
I'll understand if it was just done as an example, but I can't imagine ever wanting to do it like that when I could otherwise just create an x and y variable, and a method to set them...
Wouldn't this work just as well?
-(void) setX: (int) xAxis andY: (int) yAxis
x = xAxis;
y = yAxis;
Any insight or help would be GREATLY appreciated! Thanks!