This file contains 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
// app | |
<template> | |
<carros v-if="opcionais.length" :opcionais="opcionais" | |
</template> | |
computed: { | |
opcionais() { | |
return this.$store.getters.opcionais; | |
}, | |
}, |
This file contains 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 Boleto extends TipoDePagamento{ | |
public void debita() { | |
print("debita com demora, mas sem taxa"); | |
} | |
} |
This file contains 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 Pagamento { | |
public void executar(TipoDePagamento tipo) { | |
tipo.debita(); | |
} | |
} | |
/* | |
* Logo, podemos passar por parâmetro qualquer classe que extenda TipoDePagamento, | |
* para o método executar da classe Pagamento. | |
*/ |
This file contains 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
// Classe CartãoDebito ao extender TipoDePagamento aceita o contrato de que deve implementar o método debita | |
class CartaoDebito extends TipoDePagamento{ | |
public void debita() { | |
print("debita sem taxa"); | |
} | |
} | |
// Mesma coisa para CartaoDeCredito |
This file contains 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
abstract class TipoDePagamento { | |
/* | |
* Assinatura abstract no método, obriga as classes que extendem TipoDePagamento a implementarem o método debita, | |
* ditando assim como elas devem ser estruturadas | |
*/ | |
abstract void debita(); | |
} |
This file contains 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 CartaoDebito { | |
public void debita() { | |
print("debita sem taxa"); | |
} | |
} | |
class CartaoCredito { | |
public void debita() { | |
print("debita com taxa"); | |
} |
This file contains 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
// Removeremos essas duas condições da classe Pagamento | |
if (tipoPagamento == "Cartão de Débito"){ | |
print("debita sem taxa"); | |
} | |
if (tipoPagamento == "Cartão de Crédito"){ | |
print("debita com taxa"); | |
} |
This file contains 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 Pagamento { | |
public void executar(String tipoPagamento) { | |
if (tipoPagamento == "Cartão de Débito"){ | |
print("debita sem taxa"); | |
} | |
if (tipoPagamento == "Cartão de Crédito"){ | |
print("debita com taxa"); | |
} | |
} |
This file contains 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 Pagamento{ | |
public void executar(String tipoPagamento) { | |
if (tipoPagamento == "Cartão de Débito"){ | |
print("debita sem taxa"); | |
} | |
} |
This file contains 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
const app = new Vue({ | |
el: '#app', | |
data: { | |
errors: [], | |
name: null, | |
usuario: null, | |
senha: null, | |
age: null, | |
movie: null | |
}, |
NewerOlder