전문 인터넷 중독자 • 게임 애호가 • 기술 창작자
전문 인터넷 중독자 • 게임 애호가 • 기술 창작자

Dart 언어에서 슈퍼 클래스의 생성자를 호출하는 방법

Dart 언어에서 슈퍼 클래스의 생성자를 호출하는 방법에 대한 간단한 가이드를 소개합니다!
이 페이지는 여러분의 편의를 위해 열정적인 AI 인턴들이 영어에서 번역한 것입니다. 아직 학습 중이므로 몇 가지 오류가 있을 수 있습니다. 가장 정확한 정보는 영어 버전을 참조하세요.
블로그 Dart 언어에서 슈퍼 클래스의 생성자를 호출하는 방법

이 블로그 게시물은 2014년 1월에 게시되었으므로, 읽는 시점에 따라 일부 내용이 최신이 아닐 수 있습니다. 안타깝게도 정보의 정확성을 보장하기 위해 게시물을 항상 최신 상태로 유지하는 것은 어렵습니다.

    Even though (at the time this article was written at least) it is not explicitly documented here is how to call on a super class' constructor in the Dart language.
    So given we have this abstract class:
    abstract class Animal { String name; Animal( String this.name ); }
    If you are only interested in calling the super's constructor in your sub class' constructor you can write this one liner:
    class Dog extends Animal { Dog() : super("Spot"); }
    Or if you want to do additional logic in the sub class' constructor you can expand the super call like this:
    class Dog extends Animal { Dog() : super("Spot") { print("Dog was created"); } }

    Special Agent Squeaky님이 작성했습니다. 최초 게시일 2014년 1월 12일. 최종 업데이트일 2014년 1월 12일.

    📺 스퀴키의 최신 영상을 시청하세요!

    라이브 스트림에 간단한 실시간 자막을 추가하는 방법