- Joined
- Feb 23, 2019
- Messages
- 34
- Thread Author
- #1
Is there a way to pass variables with the class returned by successTask() and failureTask()? For example, let's say we have the following method:
To promote composition over inheritance, I would prefer to reuse the layTrapAtCoord method with 5 different coordinates. Is there a way to pass it a Coordinate variable with the class rather than develop 5 different classes each doing the same exact process but on different coordinates?
Code:
@Override
public TreeTask failureTask() {
return layTrapAtCoord;
}
To promote composition over inheritance, I would prefer to reuse the layTrapAtCoord method with 5 different coordinates. Is there a way to pass it a Coordinate variable with the class rather than develop 5 different classes each doing the same exact process but on different coordinates?