Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- ajax 사용 예시
- summary
- 모달
- 셀렉트박스 커스텀
- Router
- flex-1
- Angular Router
- formgroup
- angular button
- Ionic modal
- Oracle LISTAGG 사용 예시
- prisma
- 스크롤 이벤트 감지
- scroll
- TAILWIND
- 옵저버블
- angular route
- 호버
- 앵귤러 모달
- route
- egov spring ajax 사용 예시
- ApexChart
- 앵귤러 애니메이션
- 검색
- angular modal
- 아이오닉 스크롤 이벤트
- modal
- 스크롤 이벤트
- angular animation
- mysql if
Archives
- Today
- Total
깜놀하는 해므찌로
typescript 접근제한자 본문
반응형
SMALL
/** 접근제한자
* public(default) : 아무것도 명시하지 않으면 기본 public 생략 상태 / 어디서든 접근 가능
* protected : 자식클래스에서 접근 가능
* private : # 표기 가능 / 자기자신 클래스에서만 접근가능
*/
class Car{
#privat:number = 30;
protected protect:string = "protected";
name:string = "Car"; // default public 생략
// color:string;
constructor(public readonly color:string){
this.color = color;
}
start(){
console.log("start");
console.log(this.#privat); // private
}
}
const bmw = new Car("white");
class Bmw extends Car{
constructor(color:string){
super(color); // 반드시 호출
}
showName(){
console.log(super.name); // public
console.log(super.protect); // protected
}
}
반응형
LIST
'IT' 카테고리의 다른 글
typescript readonly 활용 예시 (0) | 2023.05.24 |
---|---|
@Observable @subscribe() (0) | 2023.05.23 |
Swiper too big size / Swiper size handle example / 스와이퍼 슬라이드 사이즈 조절 (0) | 2023.05.22 |
Angular External Url / 앵귤러 외부 url 요청 예시 / 앵귤러 새창열기 (0) | 2023.05.22 |
Tailwind 버튼 클릭 효과 / 버튼 클릭 시 커졌다 작아지는 효과 (0) | 2023.05.22 |