Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: All
Nov 27, 2000



Application Security Testing: An Integral Part of DevOps

Copy Constructor's Signatures

C++ defines four possible forms for a class's copy constructor. For a class called X, a copy constructor can have one of the following forms:

X(const X&);
X(volatile X&);
X(const volatile X&);

Note that the copy constructor's parameter cannot be passed by value. Therefore, the following forms are all illegal:

X(X); // error, pass by value
X(const X); // ditto
X(X*); // error, only references are allowed

A copy constructor can have only one parameter; additional parameters are allowed only if they have default values. For example:

X(const X&, int n=0); // OK, 2nd param has a default value
X(const X&, int n=0, void *p=NULL); // ditto
X(const X&, int n); // Illegal
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date