I found this example in this SO for delegation. I fail to see why this not an aggregation relationship? The Secretary
object continues to exist even if boss
object is destroyed
public interface Worker() {
public Result work();
}
public class Secretary() implements Worker {
public Result work() {
Result myResult = new Result();
return myResult;
}
}
can someone explain why this is delegation but not aggregation?
public class Boss() implements Worker {
private Secretary secretary;
public Result work() {
return secretary.work();
}
}