Blog Posts

Delegation Pattern and The By Keyword

Posted by oodles erp on March 19, 2024 at 3:06am 0 Comments

The delegation pattern is a technique where an object expresses a certain behavior to the outside but simultaneously delegates responsibility for implementing that behavior to an associated object.

Let's understand this with the help of an example:

Let's say we want a printer. And a printer does what it is supposed to do. Let's create an interface to show this behavior.

interface Printer {

void print(final String message);

}…

Continue

Comment

You need to be a member of On Feet Nation to add comments!

Join On Feet Nation

© 2024   Created by PH the vintage.   Powered by

Badges  |  Report an Issue  |  Terms of Service