Created
July 11, 2019 06:17
-
-
Save vinicius5581/558899849118b65c329636324ced0993 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing { | |
constructor(isLiving){ | |
this.isLiving = isLiving; | |
} | |
doSomething() { | |
console.log('doing some') | |
} | |
} | |
class Aerobic extends Thing{ | |
constructor(lungSize) { | |
super(true) | |
this.lungSize = lungSize; | |
} | |
breath() { | |
return 'Inhale, exale'; | |
} | |
} | |
const serAerobico = new Aerobic('grande'); | |
// console.dir(serAerobico) | |
class Person extends Aerobic{ | |
constructor(firstName, lastName) { | |
super('grandao') | |
this.firstName = firstName; | |
this.lastName = lastName | |
} | |
get getNameWithGet() { | |
return `${this.firstName} ${this.lastName}` | |
} | |
getName() { | |
return `${this.firstName} ${this.lastName}` | |
} | |
introduction() { | |
return `Hi, my name is ${this.getNameWithGet}` | |
} | |
} | |
class Dog extends Aerobic{ | |
constructor(name) { | |
super('pequeno') | |
this.name = name; | |
} | |
introduction() { | |
return `Woof! WOof!` | |
} | |
} | |
const Vinicius = new Person('Vinicius', 'Santana'); | |
const Fernanda = new Person('Fernanda', 'Silva'); | |
const Bro = new Dog('Bro'); | |
console.dir(Vinicius) | |
console.dir(Fernanda) | |
console.dir(Bro) | |
console.log(Vinicius.breath()) | |
console.log(Vinicius.introduction()) | |
console.log(Vinicius.getName()) | |
console.log(Vinicius.getNameWithGet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment