Skip to main content

Copy Constructor

Body

Copy Constructor

In this part you will learn: 1. What is copy constructor? 2. Usage of copy constructor 3. Syntax of Copy Constructor 4. Writing program with copy constructor 5. Showing output Copy Constructor A copy constructor is a special constructor that initializes a new object from an existing object. Following are the three occasions when copy constructor is called • When instantiating one object and initializing it with values from another object. • When passing an object by value. • When an object is returned from a function by value. What if you don’t create a copy

Add new comment

File attachments