Skip to content

Instantly share code, notes, and snippets.

@AlvarezAriel
Created October 25, 2017 21:12
Show Gist options
  • Select an option

  • Save AlvarezAriel/ac4d5ea0ed8cda215965f491d235d53f to your computer and use it in GitHub Desktop.

Select an option

Save AlvarezAriel/ac4d5ea0ed8cda215965f491d235d53f to your computer and use it in GitHub Desktop.
package ar.edu.unq.obj3.ejercicio
trait ConNombre {
def nombre:String
}
class Humano(val nombre:String, val altura:Int) extends ConNombre
class SuperHeroe(val identidad:ConNombre, val disfraz: Disfraz)
object SuperHeroe {
def crearDisfraz(normal:Humano):Disfraz = new Disfraz(normal.altura)
def vestir(conNombre: ConNombre, disfraz: Disfraz) = new SuperHeroe(conNombre,disfraz)
}
class Disfraz(val largo:Int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment