Copy Constructor

Prototype of copy constructor <classname>(const <classname>& ); Let say class name is foo. Then the copy constructor prototype will look like: foo(const foo& ); Scenarios:Below are the scenarios where copy constructor is called. 1) When an object is passed by value as function argument. 2) When function returns object by value. 3) When new object is created from an already existing/created object. Need:Compiler provides default copy constructor for each class. However, there are scenarios where we need to define the copy constructor explicitly. Consider a class below:#include <iostream>using namespace std;…