Return to Snippet

Revision: 59871
at October 5, 2012 19:35 by pligor


Initial Code
class MyClass(x: Int) {
  def myPostfixOperator: Boolean = x > 0;
}
implicit def int2myclass(x: Int) = new MyClass(x);

val y: Boolean = 1.myPostfixOperator; //this is true

Initial URL

                                

Initial Description
create a postfix operator for any object combining a class and an implicit

Initial Title
create a postfix operator for any object

Initial Tags

                                

Initial Language
Scala