I want to use the same variable defined in a class and pass the same to function.  

 For the below example I have used them separately.

I am new to Scala and learning class, objects and functions in scala .

```
class Mynewclass(var rcx: Int, var rcy: Int)  {
  var x = rcx
  var y = rcy

  def fn(fx: Int, fy: Int): Unit = {
    x = x + fx
    y = y + fy
    println(x,y)
  }
}

object ClassObject_learn {
  def main (args: Array[String]): Unit = {
    val p1 = new Mynewclass(5,6)
    val p2 = new Mynewclass(6,7)
    new Mynewclass(5,6).fn(2,3)
  }
}

```