Delegation Pattern and The By Keyword
  • Reads 1
  • Votes 0
  • Parts 1
  • Time <5 mins
  • Reads 1
  • Votes 0
  • Parts 1
  • Time <5 mins
Ongoing, First published Mar 19, 2024
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);
}
All Rights Reserved
Sign up to add Delegation Pattern and The By Keyword to your library and receive updates
or
#756java
Content Guidelines
You may also like
Slide 1 of 1
Sex and Death in Skeleton City cover

Sex and Death in Skeleton City

29 parts Complete

Geoff and Naomi are dead, and they're depressed, but when Geoff's cat Bernie dies as well, they embark on a wild journey to find it in the underworld. ***** When Geoff dies, alongside his girlfriend Naomi, they end up sharing an apartment in the Underworld as skeletons. But after a few years, Geoff starts suffering a mid-death crisis. What's the purpose of going through the motions as a skeleton if you can't really live? Then he gets word that his cat, Bernie, just died and he can collect him and bring him home! Geoff and Naomi hurry to get Bernie only to discover that, due to a clerical error, their cat has been lost. With the hunt for Bernie giving new purpose to Geoff's un-life, he and Naomi begin a quest to get back their cat. Battling skeleton pirates, climbing the sky ladder and facing off against the villain who took Bernie, Geoff is determined to find his purpose - or die a second time trying! [[2018 Wattys Winner - The Originals]] [[word count: 30,000-40,000 words]]