3

What is the meaning of a=> in the below code? is it a pointer like this to the instantiated object?

class A {
  a=>
  def methodB()={
     .....
  }
}
Pooya
  • 4,385
  • 6
  • 45
  • 73

1 Answers1

5

It is called a self reference or self type. In your case it means "create a symbol of name 'a' and point it to the this reference".

See the SO Scala tutorial in section "Self references" (chapter 17) for more information:

  1. Self references
Community
  • 1
  • 1
kiritsuku
  • 52,967
  • 18
  • 114
  • 136