Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement