Leave a Reply 3

Your email address will not be published. Required fields are marked *


gelete

gelete

D.

OCA/OCP Java SE 7 Programmer I & II Study Guide (Kathy Sierra, Bert Bates)
Object Composition Principles, 548 Chapter 10: Advanced OO and Design Patterns

public class MailerBox implements Box, Mailer { // MailerBox IS-A Box
private Box box; // MailerBox HAS-A Box

You can see the composition part, the terminology for object composition:
MailerBox both IS-A Box and HAS-A Box .
MailerBox is composed of a Box and delegates to Box for logic.

We delegate to Box to actually do the work. This is called method forwarding
or method delegation. These two terms mean the same thing.

leo yu

leo yu

Hi,Gelete, looks the concept of method delegation is that “one object delegate its behavior and state to another object”, interesting thing is : why the name is method delegation, not object delegation?