hazertothepast

Data Class as arguments

Jun 15th, 2017
171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data class Person(val name: String, val age: Int)
  2.  
  3. fun doSomething(dataarg p: Person) { ... )
  4.  
  5. // Usage:
  6. doSomething(name = "John Doe", age = 25)
  7.  
  8. // OR:
  9. val john = Person(name = "John Doe", age = 25)
  10. doSomething(**john)
RAW Paste Data