Copy Constructor - Logical Copy Constructor

Logical Copy Constructor

A logical copy constructor makes a true copy of the structure as well as its dynamic structures. Logical copy constructors come into the picture mainly when there are pointers or complex objects within the object being copied.

It can be seen from the above figure that in a logical copy constructor, a new dynamic - member variable is created for the pointer along with copying the values.

Read more about this topic:  Copy Constructor

Famous quotes containing the words logical and/or copy:

    Nature’s law says that the strong must prevent the weak from living, but only in a newspaper article or textbook can this be packaged into a comprehensible thought. In the soup of everyday life, in the mixture of minutia from which human relations are woven, it is not a law. It is a logical incongruity when both strong and weak fall victim to their mutual relations, unconsciously subservient to some unknown guiding power that stands outside of life, irrelevant to man.
    Anton Pavlovich Chekhov (1860–1904)

    Quotations—always inexact. I don’t trust people who cannot even copy out.
    Jean Rostand (1894–1977)