best answer > Can we declare a constructor as private 2024?- QuesHub | Better Than Quora
  • Can we declare a constructor as private 2024?

    函数 静态 方法

    Questioner:Amelia Wilson 2023-05-05 12:30:29
The most authoritative answer in 2024
  • Benjamin Diaz——Works at the World Health Organization, Lives in Geneva, Switzerland.

    Some reasons where you may need private constructor: The constructor can only be accessed from static factory method inside the class itself. Singleton can also belong to this category. A utility class, that only contains static methods. Yes, class can have a private constructor.read more >>
    +119962023-05-05 12:30:29

About “函数、静态、方法”,people ask:

READ MORE:

QuesHub is a place where questions meet answers, it is more authentic than Quora, but you still need to discern the answers provided by the respondents.

分享到

取消