Make a documentation of this framework by declare some variables of Actor and create some objects of GoJumpActor, JumpGoActor, asign them to the above variables and call them (mark of 4)
//Moveable interface
public interface Moveable
{
public void jump();
public void forward();
}
//Child abstract
public abstract class Child implements Moveable{
public Circle image;
public Child(){
image = new Circle();
image.makeVisible();
}
public abstract void jump();
public void forward(){
image.slowMoveHorizontal(10);
}
}
//JumpGoChild class
public class JumpGoChild extends Child{
public void jump(){
super.image.slowMoveVertical(-3);
super.forward();
}
}
//GoJumpChild class
public class GoJumpChild extends Child{
public void jump(){
super.forward();
super.image.slowMoveVertical(-3);
}
}
Make an explanation to your team about the need of this framework, also point out some of this advantages to demonstrate your awareness of the complexity of this framework (Mark of 5).
Framework trên đã làm rõ hơn khái niệm về interface và abstract:
- class Child implements interface Moveable nên nó override lại các method của Moveable.
- class Moveable là abstract class và nó có một abstract method là jump().
- class GoJumpChild và JumpGoChild là các subclass của superclass Moveable nên nó thừa kế method forward() và override lại method jump() của superclass.
No comments:
Post a Comment