Friday, 15 February 2013

Is scala reference comparison similar to c++ pointers? -



Is scala reference comparison similar to c++ pointers? -

can test equality of 2 objects using = on references? mean references behave c++ pointers (in matter of comparison)?

example - can assured each object of ll list printed once , once?

val ll: list[myobject] = // definition of list of complicated objects (x <- ll) { (y <- ll) { if (x == y) println(x) } }

i guess comparing on same object fails if references different (if having different references on same object possible).

does behavior alter if list passed argument method?

thanks clarification

in scala, == , equals equivalent except == handles null.

to check reference, must utilize eq function anyref.

scala reference comparison

No comments:

Post a Comment