---
title: "What is a copy constructor?"  
description: "What is a copy constructor?"  
author: "Shikhar Arora"  
published: 2019-12-07  
canonical: https://answers.mindstick.com/qa/92530/what-is-a-copy-constructor  
category: "technology"  
tags: ["software engineering", "programming language"]  
reading_time: 1 minute  

---

# What is a copy constructor?

What is a [copy constructor](https://www.mindstick.com/blog/170/copy-constructor-in-c-sharp)

## Answers

### Answer by Sangsaptak Pal

A constructor is the member function of a class which initializes objects of a class. It is automatically invoked during the time of object creation of the class. It is the special member function of the class.

A constructor although looks a lot like a normal function differs from that in the following ways:

- A constructor has the same name as the class
- A constructor does not have a return type
- A constructor is automatically or implicitly invoked at the time of object creation
- If the programmer does not explicitly specify a constructor, the compiler automatically defines a constructor implicitly

There are majorly three types of constructors namely:

1. Default or unparameterized constructors : Those constructors which do not take any arguments
2. Parameterized constructors : Those constructors which takes arguments
3. [Copy](https://www.mindstick.com/forum/158787/what-are-rust-s-copy-and-clone-traits-and-when-are-they-used) constructors : Those constructors which initialize an object using another object of the same class. The syntax is as follows:

[ClassName (const ClassName &old_obj);](https://www.geeksforgeeks.org/copy-constructor-in-cpp/)


---

Original Source: https://answers.mindstick.com/qa/92530/what-is-a-copy-constructor

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
