Está en la página 1de 4

Universidad Tecnológica de Nezahualcóyotl.

Aplicaciones Web Orientadas a Servicios.

Martínez Altamirano Jessica Mariel.

Examen.
Herencia.

IC-42M.

Matrícula: 193241115.

2021
class Ave{
constructor (nombre){
this.nombre=nombre;
}
get nombre(){
return this._nombre;
}
set nombre (nombre){
return this._nombre=nombre;
}
}
class Palaeognathae extends Ave{
constructor (nombre, caracteristica, nombreCientifico){
super (nombre)
this.caracteristica=caracteristica;
this.nombreCientifico=nombreCientifico;
}
get caracteristica(){
return this._caracteristica;
}
set caracteristica(caracteristica){
return this._caracteristica=caracteristica;
}
get nombreCientifico(){
return this._nombreCientifico;
}
set nombreCientifico(nombreCientifico){
return this._nombreCientifico=nombreCientifico;
}
}
class Neognathae extends Ave{
constructor (nombre, presente, distribucion ){
super ( nombre)
this.presente=presente;
this.distribucion=distribucion;
}
get presente (){
return this._presente;
}
set presente (presente){
return this._presente=presente;
}
get distribucion (){
return this._distribucion;
}
set distribucion (distribucion){
return this._distribucion=distribucion;
}
}
var av = new Ave ("Tinámidos");
var av1 = new Palaeognathae("Avestruz ", "Corredora más rápida", "Struthio camelus");
var av2 = new Neognathae ("Paloma", "En gran parte del mundo", "Amplia distribución");
Link

http://pythontutor.com/javascript.html#code=class%20Ave%7B%0A%20%20constructor
%20%28nombre%29%7B%0A%20%20%20%20this.nombre%3Dnombre%3B%0A
%20%20%20%20%7D%0A%20%20get%20nombre%28%29%7B%0A%20%20%20%20return
%20this._nombre%3B%0A%20%20%7D%0A%20%20set%20nombre%20%28nombre%29%7B%0A
%20%20%20%20return%20this._nombre%3Dnombre%3B%0A%20%20%7D%0A%7D%0Aclass
%20Palaeognathae%20extends%20Ave%7B%0A%20%20constructor%20%28nombre,
%20caracteristica,%20nombreCientifico%29%7B%0A%20%20%20%20super%20%28nombre
%29%0A%20%20%20%20this.caracteristica%3Dcaracteristica%3B%0A
%20%20%20%20this.nombreCientifico%3DnombreCientifico%3B%0A%20%20%7D%0A%20%20get
%20caracteristica%28%29%7B%0A%20%20%20%20return%20this._caracteristica%3B%0A
%20%20%7D%0A%20%20set%20caracteristica%28caracteristica%29%7B%0A
%20%20%20%20return%20this._caracteristica%3Dcaracteristica%3B%0A%20%20%7D%0A
%20%20get%20nombreCientifico%28%29%7B%0A%20%20%20%20return
%20this._nombreCientifico%3B%0A%20%20%7D%0A%20%20set%20nombreCientifico
%28nombreCientifico%29%7B%0A%20%20%20%20return%20this._nombreCientifico
%3DnombreCientifico%3B%0A%20%20%7D%0A%7D%0Aclass%20Neognathae%20extends%20Ave
%7B%0A%20%20constructor%20%28nombre,%20presente,%20distribucion%20%29%7B%0A
%20%20%20%20super%20%28%20nombre%29%0A%20%20%20%20this.presente%3Dpresente
%3B%0A%20%20%20%20this.distribucion%3Ddistribucion%3B%0A%20%20%7D%0A%20%20get
%20presente%20%28%29%7B%0A%20%20%20%20return%20this._presente%3B%0A%20%20%7D
%0A%20%20set%20presente%20%28presente%29%7B%0A%20%20%20%20return
%20this._presente%3Dpresente%3B%0A%20%20%7D%0A%20%20get%20distribucion
%20%28%29%7B%0A%20%20%20%20return%20this._distribucion%3B%0A%20%20%7D%0A
%20%20set%20distribucion%20%28distribucion%29%7B%0A%20%20%20%20return
%20this._distribucion%3Ddistribucion%3B%0A%20%20%7D%0A%7D%0Avar%20av%20%3D
%20new%20Ave%20%28%22Tin%C3%A1midos%22%29%3B%0Avar%20av1%20%3D%20new
%20Palaeognathae%28%22Avestruz%20%22,%20%22Corredora%20m%C3%A1s%20r%C3%A1pida
%22,%20%22Struthio%20camelus%22%29%3B%0Avar%20av2%20%3D%20new%20Neognathae
%20%28%22Paloma%22,%20%22En%20gran%20parte%20del%20mundo%22,%20%22Amplia
%20distribuci%C3%B3n%22%29%3B&curInstr=31&mode=display&origin=opt-
frontend.js&py=js&rawInputLstJSON=%5B%5D

También podría gustarte