Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *Funciones con parametros genericos en KOTLIN
- * Antonio Villanueva Segura
- */
- fun main() {
- //Test de llamada a una funcion con parametros genericos
- imprimeAlgo (" Hola Icaro ") //Tipo = String
- imprimeAlgo (12) //Tipo = Int
- imprimeAlgo ('a') //Tipo = Char
- imprimeAlgo (0xFFU) //Tipo = UInt
- }
- //Funcion con argumento generico T
- fun <T> imprimeAlgo (algo:T){
- println ("Tipo = ${algo!!::class.simpleName}")
- println (algo)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement