Which one copy constructor or assignment operator will be-00773
This subjective question is related to the book/course vu cs504 Software Engineering - I. It can also be found in vu cs504 Mid Term Solved Past Paper No. 3.
Question 1: Which one (copy constructor or assignment operator) will be called in each of the following code segment?
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
Answer:
- Matrix m1 (m2); copy constructor
- Matrix m1, m2; m1 = m2; assignment operator
- Matrix m1 = m2; assignment operator