Function exists for a "new" instance but not for a previously existing one?
in
Programming Questions
•
4 months ago
I have a class, Point2d
, and a function, drawPoint2d
:
class Point2d { float x, y; Point2d (float x, float y) { this.x = x; this.y = y; } } void drawPoint2d (Point2d p) { ellipse (p.x, p.y, 10, 10); }
And they seem to work fine:
void setup () { drawPoint2d (new Point2d (10, 10)); //Point2d p = new Point2d (10, 10); //drowPoint2d (p); }
However, if I were to uncomment the two commented lines, I'd receive an error message reading "The function drawPoint2d(AnExampleSketch.Point2d) does not exist.
", with "AnExampleSketch
" being the name of my sketch.
Why would this be? I'm using Processing 2.0, and I don't remember if I've encountered a similar error before.
1