This is a method inside my Rectangle class. A Rectangle object has an ivar called origin from the class XYPoint. An XYPoint object has an ivar of float x and float y. Is this method okay for setting the origin or will it be referencing the same spot in memory as pointy?
-(void) setOrigin:(XYPoint *) pointy {
origin.x = pointy.x;
origin.y = pointy.y;
}
You should be okay because you’re passing floats, not objects. By default passing a float passes the value – not the memory location – unless you put an
&in front of it.