This code helps to understand the concept of copy constructor using C++. A copy constructor is used to when an object is initialized from an existing object.
A Bank statement refers to the transaction that the owner of the account does over a specific period of time. A bank statement helps in keeping track of the amount spent and the remaining balance on that account. It covers the deposits, withdrawals, and charges of an account. The owner gets a monthly statement regarding his/her expenditure, income, and the transactions made throughout the month.
Copy constructor aloows to copy an object from another object.
Here three objects are created by defalut.
bank ob,ob1,ob2; // objects created by default
ob=bank(p,y,r); //calling parameterized constructor
Now ob2 (object 2) is copied from ob1 (object 1).
ob2=bank(ob1); //calling copy constructor
Submitted by Pratyasha Sahu (pratyashasahu)
Download packets of source code on Coders Packet