Wednesday, November 20, 2013

Data structures in Scala

How do I define my own data structures in Scala? Or does Scala does support some encapsulation mechanism?

Class similar to Java are supported in Scala. I wonder if Scala support Class then is Scala object oriented? Need to give a serious thought on this question. Any ways let me not create confusion here and first discuss the class constructs supported in Scala. Below example discuss encapsulation of rational number type and supporting various arithmetic associated.


No comments:

Post a Comment