Is possible to inject an existing object into another?

127 Views Asked by At

im using GIN and want to avoid carrying dependency without using a Singleton.

I have this scenario: 3 clases, A uses B wich uses C. A -> B -> C

I have an instance into A (with its own member values) and want to use the same instance (not create a new one nor use a singleton) on class C without pass my instance throught B.

Is this possible?? If so how can i achieve this? Thank you in advance!

0

There are 0 best solutions below