Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Programmers
- 실전프로젝트
- NotionAI
- ReactNative
- 멍친구
- 팀워크최고
- TS
- 알pdf #파일탐색기미리보기안될때
- Ai
- 프론트엔드
- typeScript
- 사전준비
- 달리기반
- 알고리즘기초주차
- REACT
- D반8조
- 프로그래머스
- 필수강의
- TDD
- Expo
- 챗GPT
- 리액트
- 웹개발종합반
- 스파르타코딩클럽
- 7기
- 코린이
- 항해99
- rn
- 맥린이
- ChatGPT
Archives
- Today
- Total
FrontEnd :-)
코딩앙마 타입스크립트 기초 강의 2 본문
#6 클래스
//접근 제한자(Access modifier) - public, private(#), protected
/*
public - 자식 클래스, 클래스 인스턴스 모두 접근 가능
private(#) - 해당 클래스 내부에서만 접근 가능
protected - 자식 클래스에서만 접근 가능
*/
class Car {
readonly name: string = "car";
color: string;
constructor(color: string, name: string){
this.color = color;
this.name = name;
}
start(){
console.log("start");
console.log(this.name);
}
}
class Bmw extends Car {
constructor(color: string, name: string){
super(color, name);
}
showName(){
console.log(super.name);
}
}
const z4 = new Bmw("black", "zzzz4")
//추상 class
abstract class Car {
color: string;
constructor(color: string){
this.color = color;
}
start(){
console.log("start");
}
abstract doSomething():void;
}
class Bmw extends Car {
constructor(color: string){
super(color);
}
doSomething(){
alert(3);
}
}
const z4 = new Bmw("black");
#6 Generic
'TypeScript' 카테고리의 다른 글
Namad TS - 5.Typescript Blockchain (0) | 2023.02.27 |
---|---|
Namad TS - 4. Classes And Interfaces ② (0) | 2023.02.25 |
Namad TS - 4. Classes And Interfaces ① (0) | 2023.02.25 |
코딩앙마 타입스크립트 기초강의 (0) | 2022.09.06 |
Comments