search

Home  >  Q&A  >  body text

What are the functions of constructor privatization and clone privatization?

What are the functions of constructor privatization and clone privatization

LevinLevin2238 days ago1021

reply all(1)I'll reply

  • 风行

    风行2018-11-26 17:19:08

    This is about the design pattern. The singleton pattern can only produce one object. The privatized constructor is to prevent the new class of external programs from losing the meaning of the singleton mode
    , and the cloning privatization prevents users from copying object instances

    reply
    0
  • Cancelreply