Will an 'empty' constructor or destructor do the same thing as the generated one?

前端 未结 7 1413
一生所求
一生所求 2020-11-28 18:49

Suppose we have a (toy) C++ class such as the following:

class Foo {
    public:
        Foo();
    private:
        int t;
};

Since no des

7条回答
  •  迷失自我
    2020-11-28 19:36

    I'd say best to put the empty declaration, it tells any future maintainers that it wasn't an oversight, and you really did mean to use the default one.

提交回复
热议问题