Null class in C + +, which class member functions are generated by default.

Source: Internet
Author: User

1. Default member functions

Class Empty

{

Public

Empty (); Default constructor

Empty (const empty&); Copy constructor

~empty (); Destructors

empty& operator= (const empty&); Assignment operators

empty* operator& (); Accessor operator

Const empty* operator& () const; Accessor operator const

};

2. A class can have multiple copy constructors in the following form:

a). For a class X, if the first parameter of a constructor is one of the following:

A) x&

b) Const x&

c) Volatile x&

d) Const volatile x&

And no other parameters or other parameters have default values, then this function is a copy constructor.

X::X (const x&); is a copy constructor

X::x (x&, int = 1); is a copy constructor

X::x (x&, int = 1, float =2.f); is a copy constructor

Null class in C + +, which class member functions are generated by default.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.