Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Md03_Dev_Back_end/Bloco26/26.1/conteudo001.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class Person {
name: string;
height: number;
weight: number;

constructor(n: string, h: number, w: number) {
console.log(`Creating person ${n}`);
this.name = n;
this.height = h;
this.weight = w;
}

sleep() {
console.log(`${this.name}: zzzzzzz`);
}
}

const p1 = new Person('Maria', 171, 58);
const p2 = new Person('João', 175, 66);
console.log(p1.name, p1.height, p1.weight);
console.log(p2.name, p2.height, p2.weight);
p1.sleep();
p2.sleep();

/*
Saída:
Creating person Maria
Creating person João
Maria 171 58
João 175 66
Maria: zzzzzzz
João: zzzzzzz
*/
22 changes: 22 additions & 0 deletions Md03_Dev_Back_end/Bloco26/26.1/conteudo002.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Tv {
private brand: string;
private size: number;
private resolution: number;
private connections: string;
private connectedTo?: boolean;

constructor(brand: string, size: number, resolution: number, connections: string) {
this.brand = brand;
this.size = size;
this.resolution= resolution;
this.connections = connections;
}

public turnOn() {
return `brand: ${this.brand}, size: ${this.size}, resolution: ${this.resolution}, connections: ${this.connections}`
}
}

const minhaTv = new Tv('mike', 10, 140, 'sóuma');

console.log(minhaTv.turnOn());