I'm new to programming and have some questions about classes.
I'll use Karel as an example:
public class Karel extends robot{
....
}
then I extend Karel:
public class SuperKarel extends Karel{
....
}
but then I want to organize some groups of methods:
public class KarelJumps extends SuperKarel {
....
}
public class KarelColor extends SuperKarel {
....
}
But then if I want to make Karel jump I have to create an instance of
KarelJumps
rather the SuperKarel
. But because KarelJumps
is a
different object then KarelColor
I couldn't use any of its methods.
So would I just put all of the KarelJumps
and KarelColor
methods
inside SuperKarel?
Do I just make one large object?