title: Basic Scala OOP question - pass by reference?
body: <p>I'm a little stumped at how silly this problem is and have a serious mindblank, but I thought I might ask anyway.</p>
  
  <p>I have an object Foo, with several fields. I want a method that can change any of its fields depending on which one is passed in as a parameter. Like so:</p>
  
  <pre><code>class Foo {
      var x = 0
      var y = 0
  }
  
  class Bar {
      def changeFooField(field : Int) = {
          field = 1        
      }
  }
  </code></pre>
  
  <p>Can I not use it like so?:</p>
  
  <pre><code>changeFooField(foo.x)
  </code></pre>
  
  <p>If not, how do I accomplish this?</p>