I am new to programming and ask some questions about classes.
I use Karel as an example:
public class Karel extends robot{
....
}
then I expand Karel:
public class SuperKarel extends Karel{
....
}
but then I want to organize several groups of methods:
public class KarelJumps extends SuperKarel {
....
}
public class KarelColor extends SuperKarel {
....
}
But if I want to make a Karel jump, I need to instantiate it
KarelJumpssooner SuperKarel. But since there KarelJumpsis another object, then KarelColorI could not use any of its methods.
I would just put all the methods KarelJumpsand KarelColor
inside SuperKarel?I just make one big object?
source
share