인프런 커뮤니티 질문&답변
id를 제외한 생성자 만들기
작성
·
623
·
수정됨
답변 2
1
1
ID is supposed to be created and populated from DB, so it is not expected to be given when Constructor is called.
In this class, the item.seId(++sequence) simulate what DB does. But in the real repository class, ID will be populated by the DB. Either way, ID is not expected to be passed which is the reason Constructore does not have the parameter in its method signature.







