lets say I have classA and classB.
I know that I cannot just call a non static variable or method of classA from classB because the system doesn't know which instance of classA I want to use. but is there a way to specify which instance?
something like this: in class A I declare a static variable which whould hold the some sort of ID or context to the specific instance of the class
class classA{ static Instance instance onCreate(){ instance = thisInstance(); } Method1(){ } } then in class B I would refer to that instance like this:
ClassA.instance.method1(); is something like this possible? if so, what is the exact syntax?
[Bonus]: if no, what is the simplest way invoke a method in a class from another class? I assume some sort of event handling would be required. (I come from the embedded c world)
Singletonpattern