Anonymous user
Send an unknown method call: Difference between revisions
Scala added
No edit summary |
(Scala added) |
||
Line 444:
e.send :privacy # => "secret"</lang>
=={{header|Scala}}==
[[Category:Scala Implementations]]{{libheader|Scala}}<lang scala>class Example {
def foo(x: Int): Int = 42 + x
}
object Main extends App {
val example = new Example
val meth = example.getClass.getMethod("foo", classOf[Int])
assert(meth.invoke(example, 5.asInstanceOf[AnyRef]) == 47.asInstanceOf[AnyRef], "Not confirm expectation.")
println(s"Successfully completed without errors. [total ${scala.compat.Platform.currentTime - executionStart} ms]")
}</lang>
=={{header|Smalltalk}}==
<lang smalltalk>Object subclass: #Example.
|