Is there a way to set the x and y at the same time using the Point object?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, not unless you use the constructor. The Point class does have an offset(x,y) function, so you could do something like point.offset(-1*point.x+newX, -1*point.y+newY), which would have the effect that you desire.
Is there a particular reason you want to set it at the same time or are you just trying to write compact code?