What does a compiler add to an empty class declaration?
问题 Suppose, I write class A { }; The compiler should provide (as and when needed) a constructor a destructor a copy constructor = operator Is this all the compiler provides? Are there any additions or deletions to this list? 回答1: It's complete. But there are two points you should note: It's the copy =operator. Just like there is a copy constructor, there is a copy assignment operator. They are only provided if actually used. Some explanation for 2: struct A { private: A(); }; struct B : A { };