Some questions about abstract class with private, public and protected constructors

前端 未结 5 1251
北海茫月
北海茫月 2021-02-09 21:30

My first question: What is the difference between an protected and a public constructor in an abstract class?

My second questions: Does it make sense, if the abstract cl

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-09 22:24

    1. Very little. The public constructor can only be used as a protected one.

    2. Yes, it can be called ('sideways') with the this keyword from other (protected/public) constructors.

提交回复
热议问题