We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am having an issue calling a constructor of a class I have defined in another tab.
The type def of the constructor is: Ring(int, int, color). The error is saying it can't find a Ring(int, int, int). I realize that ultimately a color is just an int; however, I can't help but thing this is screwing processing here.
Having issues loading an image so I posted it here: snapshot
Answers
Since Processing's pre-processor changes
color
toint
before compilation then changing the constructor definition to Ring(int, int, int) it won't make ANY difference what so ever.Since there is also a method color() I suggest that you use int instead of color for data types as it can save problems like this occurring.
I changed the color defs to ints. Still same error.
Why does it say ELwave.Ring() if I am defining the class Ring on another tab/file?
Nevermind on the ELwave.Ring() question. I see that Processing automagically takes tabs and makes classes innerClasses.
Still not sure why it can't find the constructor though.
Can you post the code that attempts to call the constructor and the constructors for this class.
class
Hi, I think your problem is that constructors doesn't have a return type, neither "void", so actually you have no constructors...
In the class, on lines 10 and 14 get rid of "void", and you are ok.
after doing that There were some other errors, I comment them out and code runs fine :)
try...
...yes, I was in the middle of editing the class when I copied it.
nixed the voids and now getting a Ring(int, int, int) does not exist on line 11.
that's because in the first constructor you call a the other constructor in a way, i believe is wrong. A constructor is expected to be called using new key word. I think I would do some thing like this (untested):
cascading constructors should be fine and are used in C++, C#, and Java. I tried changing 11 to this.Ring(...) but that didn't work either.
I /commented/ out the fist constructor and it worked fine.
Not sure why the cascade didn't work.
Indeed, here what I found in google:
Ahh this(); I switch between C++, C, Java, and JavaScript and these subtleties get me all the time...