 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can create area of static and dynamic objects in C++. Before starting, you can note my information, you can connect with me by following these details, you can download my app Techimus that is available on Google Play, you can search my channel on YouTube by typing my name on YouTube search bar, my channel will be available there, you can subscribe my channel if you want to follow my programming related videos. In this channel, various programming language related videos and playlists are available, you can follow this video if you want to learn programming. Now coming on to the topic, you can see a comment area of static versus dynamic objects in C++ is written here. For that purpose I have included a header file iostream then namespace std is used name of classes student it has two attributes roll number and name then read function is implemented it will display enter roll number message on console then roll number will be stored inside RnO variable then enter name message will be displayed on console then name will be stored inside name variable after completion of read function print is implemented it will display roll number and name on console that user has entered after termination of class using this semicolon main function is implemented here you can see area of static object is created name of arrays s and its size is 3 so this is static objects array because its size cannot be modified at execution time so for reading loop is repeated three times it is calling read function through s of i and then print function is called inside loop this loop is repeating again three times and print function is called through s of i so this is array of static object creation now first time executing this code you can see it is asking for roll number so I'm entering one then name of student it is again asking for roll number I am entering two and name of student it is asking again for roll number I am entering three and name of student I have entered three students detail you can see it is showing all the details on console so this is static objects array now I am going to convert it into dynamic array so first I am declaring a pointer p then an integer variable and then I am showing a message enter size or you can say enter number of objects how many number of objects you want to create I am receiving that value inside and variable now with the help of new I am going to allocate memory so here array of dynamic objects is created with the help of this statement p equals to new student and so n will be provided by the user so at this time at compilation time we cannot predict how much amount of memory will be allocated it will be decided at runtime so that's why it is known as array of dynamic object after that loop will repeat n times at the time of reading and printing so friends this is implementation of array of dynamic objects I hope you have understood the difference between static and dynamic object creation or dynamic array of objects creation in static array creation size was fixed but in case of dynamic size is not fixed it is provided by the user at execution time now I am executing this code sorry here I have to use p of i instead of s because this time pointer is p in static array name of array was s it is executing properly it is asking for number of objects so I am entering for so this time it will receive information of four students so I am entering first student details now it is asking for second then third student detail and then fourth student details you can see the output first second third and fourth all four students details are displayed on console so friends this way you can create array of static objects as well as array of dynamic objects the difference is in case of static object memory is allocated at compilation time so you have to fix the amount of memory that you want to allocate but in case of dynamic objects or array of dynamic objects memory is allocated at runtime so you can receive how much amount of memory will be allocated at runtime by the user so dynamic object creation is better as compared to static object creation and in both the cases implementation of class is same whether you are creating static object or you are creating dynamic objects if you want to watch more programming related videos you can search my channel on YouTube by typing my name on search bar here various programming related videos and YouTube playlist are available thank you for watching this video