How do I make this C++ object non-copyable?

前端 未结 10 992
太阳男子
太阳男子 2020-11-28 04:36

See title.

I have:

class Foo {
   private:
     Foo();
   public:
     static Foo* create();
}

What need I do from here to make Fo

10条回答
  •  余生分开走
    2020-11-28 05:19

    Make the copy constructor and the assignment operator private as well. Just the declaration is enough, you don't have to provide an implementation.

提交回复
热议问题