 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can add elements of two dynamic 2D metrics in C++. You can connect with me by following these details if you want to learn programming. You can subscribe my YouTube channel. You can search my channel on YouTube by typing my name in search bar. My channel will be available there. You can open my channel and you can subscribe it by clicking on this red button. You can watch various videos and playlist which are available in my channel on various programming languages. Now coming on to the topic. In this video I will be demonstrating how you can calculate some of two dynamic 2D metrics in C++ using new and delete operators. First I have included a header file IO stream. Then a namespace std is used using keyword. It is already defined in IO stream and it is for seen and see out objects. Then a class metrics is defined. Inside this class p pointer to pointer is declared and row and column variables are c are declared. Then in public section set size function destroy read print and some five functions are declared. Then class is terminated after termination of class. All five functions which are declared inside the class are defined. So first function is set size. This void is written type. Then matrix is name of class. Then scope resolution operator. Then name of function is set size and then parenthesis. Inside curly basis the definition of this set size function is written. Here see out will print enter rows and columns and the values are received using seen inside R and C variables. Then using this statement p equals to new integer pointer are memory for rows will be allocated and here memory of integer pointer type will be created using new operator and base address will be assigned into p. Then for creating columns, this loop is started, which is starting from zero and it will end till R. Then p of i equals to new and C. This statement will create a memory blocks for columns after creation of memory using set size function. Another function is defined, which is destroyer. This function will deallocates memory for columns first by using this loop and after completion of this loop, it will delete p pointer to pointer, which is allocating memory for number of rows. Then read function is defined. Read function is responsible for reading values from user. So here two loops are implemented in nested formation. First loop is repeating R times and second loop is repeating column times and all the elements are received using seen p of ij. After read function, print function is defined. It is also having two nested loops, one for rows and second for columns. And it is displaying elements of 2D matrix using see out statement. After completion of this inner loop, handle will change the line. So output will be displayed in matrix format. Then for addition purpose, this sum function is defined. Inside this function, two arguments are received inside M1 and M2. These formal parameters will receive values of explicit arguments. Then again, first loop for rows and second loop for columns are repeated. Row loop is known as outer loop and column loop is known as inner loop. Then inside inner loop addition is performed. Here p of ij is representing implicit argument. M1 dot p of ij is representing first explicit argument and M2 dot p of ij is representing second explicit argument. You can see p of ij is available in all the expression. This p is representing array. So here three arrays are used simultaneously. Two are adding using M1 and M2 and third one is storing their result. After completion of this loop, some function will be terminated. After some main function is defined, here three objects of matrix class are declared M1, M2, M3. Then set size functions are called for all three objects. These functions will be creating dynamic memory locations for all three objects. Then using see out M1 dot read and see out M2 dot read. Values of first and second matrix will be read from user. Then M3 dot sum M1 M2. This function will be calling some function. Here M3 is implicit argument and M1 and M2 are explicit arguments. So in some function, this p of ij is representing M3 and M1 dot p of ij and M2 dot p of ij are representing M1 and M2 explicit arguments respectively. The sum will be assigned into this M3 object. So it is displayed using M3 dot print statement. So here print function is called which will display the elements of M3 matrix. Then all three objects are destroyed using destroy function call and then return zero is available because return type of main is integer. So this way elements of two dynamic matrix are added and the result is assigned into third matrix. Now I'm going to execute this code. You can see it is asking for rows and columns. So I'm entering two and two. It is asking for rows and column for second matrix. I am again entering two two. Now it is asking for rows and columns for third matrix. Again, I am entering two two. Then it is asking for values for first matrix. I'm entering one for second matrix. I am entering two. You can see some is three three three three and some is displayed in matrix format. So friends this way elements of two dynamic 2D arrays are added using this program. I hope you have understood how this program is implemented using new and delete operators. If you want to watch more programming related videos, you can subscribe my channel on YouTube. Here various videos and programming related playlists are available. So keep following my YouTube channel. Thank you for watching this video.