강의

멘토링

커뮤니티

Inflearn Community Q&A

donghee02594356's profile image
donghee02594356

asked

(2026) Pass the Information Processing Engineer Practical Exam in One Week

Inheritance and Constructor Call Order

파라미터?

Resolved

Written on

·

121

0

  • 7:20
    'Car constructor'가 호출되는 이유는 파라미터가 없기 때문이라고 하셨는데 파라미터가 뭔지 헷갈려서 질문 남깁니다.

model이 파라미터인가요?

pythonjavac정보처리기사

Answer 1

0

weekendcode님의 프로필 이미지
weekendcode
Instructor

괄호 안에 들어가는 것이 파라미터입니다.

입력값, 파라미터, 인자 등 여러가지 이름으로 불렸습니다.

 

지금은 new ElectricCar(); 이렇게 되어있습니다. 생성자에 파라미터가 없는 것입니다.

new ElectricCar("Hello"); <- 이게 파라미터로 "Hello"가 들어간 것입니다.

 

그래서 자식 생성자 가봤는데, 부모 생성자를 명시적으로 부른게 없죠.

그러면 단순히 기본 생성자만 호출합니다.

그래서 부모 기본생성자 -> 자식 기본생성자 이렇게 출력한 것입니다.

donghee02594356's profile image
donghee02594356

asked

Ask a question