How would I access existing variable data in Scala. I'll give an example:
Class storage: Has a map (and other data which I use)
In class A:
val storageManager = new storage();
storageManager.putValue("key","value");
println("A: " + storageManager.getValue("key"));
In class B:
val storageManager2 = new storage();
println("B: " + storageManager2.getValue("key"));
Results are:
A: value
B: null
I'd like to get class B to print "value" as well i.e. make the contents in the storage class the same for all classes accessing them.
Is passing the storeManager variable the only way? as I would wish to avoid that