Page 133 - DCAP404 _Object Oriented Programming
P. 133
Object-oriented Programming
Notes getch();
}
Let us assume we run this program with the following input.
/*
Enter Size of matrix :- 2 2
Please Enter A No At Position 00 :- 1
Please Enter A No At Position 01 : - 1
Please Enter A No At Position 10 : - 2
Please Enter A No At Position 11 :- 2
*1
You should see the following output.
/*
The Matrix Entered
1 1
2 2
The Squared Matrix
1 1
4 4
The Cubed Matrix
1 1
8 8
*/
The Constructor first creates a vector pointer to an int of size dl. Then it allocates, iteratively, an
int type vector of size d2 pointed at each element p[i]. Thus space for the element of a d1x d2
matrix is allocated from free store.
Self Assessment
Fill in the blanks:
7. A copy constructor method allows an object to be initialized with another object of the
……………….. class.
8. A copy constructor has a ………………… parameter of reference type that refers to the
class itself.
9. The memory is saved as it …………………. the right amount of memory for each object.
10. Allocation of ………………… to objects at the time of their construction is known as
dynamic construction of objects.
126 LOVELY PROFESSIONAL UNIVERSITY