Herencia e interfaces en Ceylon

/* run.ceylon */ shared void run(){ value hand=SerialKiller("Thomas Handler",34,"The Hand's God"); print(hand.description); hand.matar(); } interface Habilidades{ shared formal void matar(); } class Psycho(String nombre,Integer edad){ shared default String description =>"(``nombre``, ``edad``)"; } class SerialKiller(String nombre, Integer edad,String sobrenombre) extends Psycho(nombre,edad) satisfies Habilidades{ description = "``sobrenombre``: (nombre real: ``nombre``, edad: ``edad``)"; shared actual void matar(){ print("El Serial Killer ``sobrenombre`` ha atacado de nuevo "); } } /* compilar: ceylon compile source/holaCeylon/run.ceylon ejecutar: ceylon run holaCeylon/1.0.0 */

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.