I guess doing this functionally would not harm, but I wanted to understand if it causes ambiguity in understanding the code.
I would like to explain using a simple example where I have a ProcessFactory
which creates Process
instances internally but returns a ProcessManager
instead of Process
instance.
And, ProcessManager
is a class which adapts some of the Process
functionality and adds more functions related to management of process.
The reason for doing this is that the client is not required to deal with the complex functionality which a Process
provides but only needs to manage some aspects of it thru ProcessManager
, while manager also adds some extra functionality on its own.