What does the compiler add to an empty class declaration?

Suppose I write

class A { };

The compiler should provide (as needed)

  • constructor
  • destructor
  • copy constructor
  • = operator

Is that all the compiler provides? Are there any additions or deletions to this list?

+3
source share
4 answers

This is completed. But there are two points that you should note:

  • This is the copy = operator. Just as there is a copy constructor, there is a copy assignment operator.
  • They are provided only for actual use.

Some explanation for 2:

struct A { private: A(); };
struct B : A { };

! "B", . ( ) ( , ), .

+6

. , .

+1

............ FOUR (), , .

0

:

(&) -

0

Source: https://habr.com/ru/post/1741604/


All Articles