Skip to content

Udemy/Ts/section5/59 : classs #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Sep 20, 2024
Merged

Udemy/Ts/section5/59 : classs #35

merged 34 commits into from
Sep 20, 2024

Conversation

4BFC
Copy link
Member

@4BFC 4BFC commented Sep 20, 2024

✍Udemy/Ts/section5/59 : classs

본 PR은 청강 1회독을 마친 후 N회독으로 작성된 PR입니다.

🔥KeyWord

  • class
  • constructor
  • new

📝Description

  • 인터페이스를 이해하기 위해서는 js의 class형을 이해하고 구현해봐야한다. 물론 과거에 Java와 C#을 통해서 어느정도 class의 개념을 익혀 두었지만 다시 상기를 한다고 생각하고 해당 강의와 실습을 해보았다. 아래 코드를 살펴보면서 글을 읽어보면 좋을 것이다.
  • 🚩: interface를 학습하기 위해 클래스를 학습하고 실습해보았다.
  • 클래스 안에 있는 요소
    • 클래스 안에 들어 있는 name과 같은 요소는 프로퍼티(Property)라는 자산, 속성을 의미하는 객체이다. 이를 통해서 청사진을 생성성해서 코드를 재활용할 수 있는 환경을 제공할 수 있다.
  • constructor
    • constructor는 생성자이다. 이를 통해서 해당 클래스를 할당 또는 재활용 할 때 자동으로 실행되는 함수이다. 위의 코드를 살펴보면 n이라는 매개변수를 받아서 this를 통해 class 내부 전역 객체인 name을 참조해서 할당하게 한다.
  • new
    • new는 우리가 흔히 js에서 Array를 배열을 생성할 때 많이 접했을 것이다. new를 통해서 청사진인 class를 생성하게 되는데 이때 log를 찍어보면 생성한 Department 프로퍼티가 어떤 값을 할당했는지 확인할 수 있다.
        Department { name: 'Accounting' }
      

📌Summary

  • class의 기본이기에 어려움 없이 학습과 실습을 했다. 이것이 추후 interface와 긴밀하게 연결이 되기 때문에 잘 기억해두면 좋을 듯 하다.

4BFC and others added 30 commits August 27, 2024 01:50
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 작성한 커밋입니다.
Github에서 작성한 커밋입니다.
Github에서 수정한 커밋입니다.
Github에서 수정한 커밋입니다.
@4BFC 4BFC added the 2회독 회독 label Sep 20, 2024
@4BFC 4BFC added this to the Udemy:TypeScript milestone Sep 20, 2024
@4BFC 4BFC self-assigned this Sep 20, 2024
@4BFC 4BFC changed the title Udemy/ts/section5/59 : classs Udemy/Ts/section5/59 : classs Sep 20, 2024
@4BFC 4BFC merged commit 4c4de90 into UdemyTs Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2회독 회독
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant