title: Access variable from another class in Scala
body: <p>How would I access existing variable data in Scala. I'll give an example:</p>
  
  <p>Class storage: Has a map (and other data which I use)</p>
  
  <p>In class A:</p>
  
  <pre><code>val storageManager = new storage();
  storageManager.putValue("key","value");
  println("A: " + storageManager.getValue("key"));
  </code></pre>
  
  <p>In class B:</p>
  
  <pre><code>val storageManager2 = new storage();
  println("B: " + storageManager2.getValue("key"));
  </code></pre>
  
  <p>Results are:</p>
  
  <pre><code>A: value
  
  B: null
  </code></pre>
  
  <p>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. </p>
  
  <p>Is passing the storeManager variable the only way? as I would wish to avoid that</p>