How to use a object whose copy constructor and copy assignment is private?

前端 未结 6 526
甜味超标
甜味超标 2021-01-14 07:43

In reading TCPL, I got a problem, as the title refered, and then \'private\' class is:

class Unique_handle {
private:
    Unique_handle& operato         


        
6条回答
  •  逝去的感伤
    2021-01-14 08:16

    I have googled my question, and find a way to construct such a object:

    static Unique_handle* instance() { return new Unique_handle(); }

    but it seems wrong, then how can I define such a object outside?

    Anyway, thank you for all of your concern.

提交回复
热议问题