Copy constructor

Nasza ocena:

3
Wyświetleń: 651
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Copy constructor - strona 1 Copy constructor - strona 2

Fragment notatki:

Copy constructor  Used for initializing objects using other objects of the same class, for the T class: T::T(const T &);  Parameter has to be a reference; otherwise temp. object would be created, that should also be somehow initialized - with the copy constructor!  Parameter should be const to permit to call the constructor with const argument  For example. c.c. of the point class: point(const point & p) :x(p.x), y(p.y) {}  As a copy constructor for class T we may use other constructor that may be called with one argument of type &T: point(const point &, int=7); ... zobacz całą notatkę



Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz