diff --git a/Md03_Dev_Back_end/Bloco26/26.1/conteudo001.ts b/Md03_Dev_Back_end/Bloco26/26.1/conteudo001.ts new file mode 100644 index 00000000..d0fd5847 --- /dev/null +++ b/Md03_Dev_Back_end/Bloco26/26.1/conteudo001.ts @@ -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 +*/ \ No newline at end of file diff --git a/Md03_Dev_Back_end/Bloco26/26.1/conteudo002.ts b/Md03_Dev_Back_end/Bloco26/26.1/conteudo002.ts new file mode 100644 index 00000000..ca518491 --- /dev/null +++ b/Md03_Dev_Back_end/Bloco26/26.1/conteudo002.ts @@ -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());