2022-09-13
09:00-17:00 / 17:00-19:00 / 21:00~22:00 / 23:00-24:00
abstract class User{
constructor(
private firstName:string,
private lastName:string,
protected nickname:string
){}
abstract getNickName():void
}
}
class Player extends User{
getNickName(){
console.log(this.nickname)
}
}
const nico = new Player("nico","las","니꼬");
const nico new User("nico","las","니꼬");
// 추상 클래스의 인스턴스는 만들 수 없음
nico.firstName
nico.getNickname()
nico.nickname // error protected니까
상속 받은 클래스 내 사용가능 0 X
인스턴스 사용가능 X X
type Words ={
[key:string]:string
}
class Dict {
private words: Words
constructor(){
this.words = {}
}
add(word:Word){
if(this.words[word.term]===undefined){
this.words[word.term] = word.def
}
}
def(term:string){
return this.words[term]
}
update(word:Word){
if(this.words[word.term]!==undefined){
this.words[word.term]=word.def;
}
}
del(term:string){
if(this.words[word.temr]!=undefined){
delete this.words[term]
}
}
size(){
return Object.keys(this.words).length
}
all(){
for(let [key,values]of Object.entries(this.words)){
console.log(`${key}:${value}`)
}
}
}
class Word {
constructor(
public readonly term:string, // 수정 못하게
public readonly def:string
){}
}
const kimchi = new Word("kimchi","한국음식");
const dict = new Dict()
dict.add(kimchi);
dic.def("kimchi")
type Nickname =string
type Health = number
type Friends = Array<string>
type Player ={
nickname:Nickname,
healthBar:Health
}
const nico:Player = {
nickname:"nico",
healthBar:10
}
type Food =string;
const kimchi:Food = "delicious"
type Team= "read"|"blue"|"yellow"
type Health = 1|5|10
type Player={
nickname:string.
team:Team,
health:Health
}
const nico :Player={
nickname:"nico",
team:"yellow",
health:10
}
type Team= "red"|"blue"|"yellow"
type Health = 1|5|10
interface Player={
nickname:string.
team:Team,
health:Health
}
const nico :Player={
nickname:"nico",
team:"yellow",
health:10
}
type User = {
name:string
}
type Player = User &{
}
const nico:Player={
name:"nico"
}
interface User{
name:string
}
interface Player extends User{
}
const nico:Player={
name:"nico"
}
interface User{
name:string
}
interface User{
lastName:string
}
interface User{
health:number
}
const nico:User{
name:"nico",
lastName:"las",
haalth:10
}
abstract class User{
constructor(
protected firstName:string,
protected lastName:string
){}
abstract sayHi(name:string):string
abstract fullName():string
}
class Player extends User{
fullName(){
return `${this.firstName} ${this.lastName}`
}
sayHi(name:string){
return `Hello ${name}. My name is ${this.fullName()}`
}
}
interface User{
firstName:string,
lastName:string,
sayHi(name:string):string
fullName():string
}
inteface Human{
health:number
}
class Player implements User,Human{
constructor(
public firstName:string,
public lastName:string,
pulbic health:number
){}
fullName(){
return `${this.firstName} ${this.lastName}`
}
sayHi(name:string){
return `Hello ${name}. My name is ${this.fullName()}`
}
type PlaeyrA ={
name:string
}
type PlayerAA= PlayerA &{
lastName:string
}
const playerA:PlayerA={
name:"nico",
lastName:"xxx"
}
interface PlayerB{
name:string
}
interface PlayerBB extends PlayerB{
lastName:string
}
interface PlayerBB {
health:number
}
const playerB:PlayerB={
name:"nico",
lastName:"xxx",
health:2
}
type PlayerA={
firstName:string
}
interface PlayerB{
firstName:string
}
class User implements PlayerB{
constructor(
public firstName:string
){}
}
Monday/ Wednesday(Tuesday)/ Thursday 19:45-20:15 (English with Clarisse)
Tuesday / Thursday 21:00 ~ 22:00 (어깨 수영 보류)
Saturday 09:00~10:00
Sunday
allow me to~