Delegating to a Parameter
We'll cover the following...
The problem
In the previous example, we wrote Worker
by JavaProgrammer()
, which says that the Manager
instance is delegating to an implicitly created instance of the JavaProgrammer
, but that poses two issues. First, the instances of Manager
class can only route to instances of JavaProgrammer
, not to instances of any other Worker
implementors. Second, an instance of Manager
doesn’t have access to the ...