To tylko jedna z 2 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
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)