Explain Copy constructor

Copy constructor: It is a constructor which takes a single argument of similar class. For illustration:

    public class Point {
            // Utilize p's attributes to initialize this object.
        public Point(Point p){
            ...
        }
        ...
    }

The argument is employed to state the initial values of the latest object's attributes.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.