Variable cannot be resolved or is not a field when using instanceof
in
Programming Questions
•
2 years ago
So hello folks, I started a roguelike and the problem is that;
for (Iterator cit = crs.iterator(); cit.hasNext(); ) {
Character chr = (Character) cit.next();
if (chr instanceof Door && inr(x, y, chr.x, chr.y)) {
if (chr.cld) chr.cld = !chr.cld;
else if (!chr.cld) chr.cld = !chr.cld;
}
}
Returns me the error chr.cld cannot be resolved or is not a field, I wonder if it's due to the fact that Door class extends Character class and has a boolean called cld but the Character does not
How can I go on?
1