// 01
// SUPERCLASSE
class Empresa{
constructor(
public nome_empresa: string,
public ramo_atividade: string
){}
}
// CLASSE DERIVADA
class Servicos extends Empresa{
constructor(
nome_empresa: string,
ramo_atividade: string,
public tipo_servico: string,
public telefone: string,
public email: string
){
super(nome_empresa, ramo_atividade);
}
// MÉTODO IMPRIMIR
imprimir(){
console.log(`Nome da Empresa: ${this.nome_empresa}`);
console.log(`Ramo de Atividade: ${this.ramo_atividade}`);
console.log(`Tipo de Serviço: ${this.tipo_servico}`);
console.log(`Telefone: ${this.telefone}`);
console.log(`E-mail: ${this.email}`);
}
}
// OBJETO - PASSANDO OS PARÂMETROS/DADOS
let s = new Servicos(
"Tech Solutions",
"Tecnologia",
"Desenvolvimento de Aplicativos",
"(51) 9999 8888",
"sac@techsolutions.com.br"
);
// CHAMANDO O MÉTODO
s.imprimir();
To embed this project on your website, copy the following code and paste it into your website's HTML: