This site requires JavaScript, please enable it in your browser!
Greenfoot back
SOUPNAZI
SOUPNAZI wrote ...

2015/5/11

Question confusion?

SOUPNAZI SOUPNAZI

2015/5/11

#
I did a side by side comparison of both classes & found that A) was in both classes; B), C) & D) were not in the Animal class BUT it states that all 3 are inherited from greenfoot.Actor; and E) was in NEITHER class....with these as the only options to select from wouldnt this information make this question invalid? The question states Which method below is in the Animal class but NOT in the Actor class? Question options: A) move() B) getX() C) getY() D) getRotation() OR E) getHeight()
danpost danpost

2015/5/11

#
Your original assessment is flawed. Either that or you are not realizing that the methods given are 'method signatures' (which consist of both the name of the method plus the order of typed parameters for the method.
Super_Hippo Super_Hippo

2015/5/11

#
If you don't get it, you can just try it out. Create a subclass of Animal and try out every method. Create a subclass of actor (and not Animal) and try every method which worked in the Animal class.
SOUPNAZI SOUPNAZI

2015/5/11

#
Super_Hippo wrote...
If you don't get it, you can just try it out. Create a subclass of Animal and try out every method. Create a subclass of actor (and not Animal) and try every method which worked in the Animal class.
ok wow then my answer is now A) . I did as you suggested and move(); in the Actor class gave an error "method move in class greenfoot.Actor cannot be given types; required: int; found: no arguments; reason: actual and formal argument lists differ in length." Doing this individually helped me pick the right answer but I am still confused. I went back and read over chapters 1-3, including the the brief summary of method signatures in my Greenfoot book and I think the reason move(); didnt work for the Actor class is because it has to be assigned to the animal as Actor can't be given types?...I just noticed the book differs from the website I viewed that listed move() as a method for Actor. The book omits what was on the website. I just am confused why Greenfoot would allow me to add the others (besides height) and have a subclass for the Actor but it cant move. I'm very new to all this obviously so please forgive my confusion.
SOUPNAZI SOUPNAZI

2015/5/11

#
danpost wrote...
Your original assessment is flawed. Either that or you are not realizing that the methods given are 'method signatures' (which consist of both the name of the method plus the order of typed parameters for the method.
OR
Super_Hippo wrote...
If you don't get it, you can just try it out. Create a subclass of Animal and try out every method. Create a subclass of actor (and not Animal) and try every method which worked in the Animal class.
Am I on the some what right path?
danpost danpost

2015/5/12

#
The problem is that the 'move' method provided by the Actor class has the signature 'move(int)' while the one in the Animal class has the signature 'move()'. You can use 'move(int)' from any Actor subclass (including the Animal class) because that method is defined in the Actor class; for the same reason, you can only use 'move()' from any subclass of Animal (or from the Animal class itself, since it is an editable class).
You need to login to post a reply.