I got 3 classes, A,B and C.
Only 1 instance of class A exits at any given time but hundreds of objects of class B and C will exist.
Class A calls a method of class B. Class B calls a method of class C. And class C eventually calls a method of the class A object.
What would be the best and cleanest way to provide the reference to the class A object in C?
- Saving it in a private variable and initializing it via the constructor?
- Creating a static getInstance() method in Class A which returns the object itself?
- Or passing "this" through parameters from A to B to C?
Any C Object will call the method of A multiple time in his lifetime.