简体   繁体   中英

Does the compiler provide a address operator?

"How many functions does compiler implement for us if we don't define one?", I think that there are only 4 :

  • default ctor

  • copy ctor

  • assignment operator

  • default destructor

But someone says that there are still one or more default functions: address operator and address operator for const object ,is this right?

No, the address operator is not implicitly overloaded for a class type. If you don't overload it, then the built-in operator can be applied to objects of that type, just as it can be applied to any object or function.

Note that in modern C++, you can add "move constructor" and "move-assignment operator" to your list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM