Class Self-Reference
Posted
by
Free Bullets
on Stack Overflow
See other posts from Stack Overflow
or by Free Bullets
Published on 2010-12-24T02:46:57Z
Indexed on
2010/12/24
2:54 UTC
Read the original article
Hit count: 405
I have the following code. The angle function needs some information from the class it was called from. What's the best way to do this?
class MyScannedRobotEvent extends robocode.ScannedRobotEvent {
public int angle(robocode.Robot myRobot) {
return (int) Math.toRadians((myRobot.getHeading() + getBearing()) % 360);
}
}
public class MyRobot extends robocode.Robot {
int a = angle(**WHATDOIPUTHERE?**)
}
© Stack Overflow or respective owner