Sign up now
to enroll in courses, follow best educators, interact with the community and track your progress.
Download
Objects Oriented Programming Part 10: Computer Science & Applications (in Hindi)
177 plays

More
This lesson describes the important concepts of object oriented programming.

Sandeep
Co-founder of BSI Academy and running YouTube channel. 5 years of teaching experience. Qualified in UGC NET & CSIR in Computer Science as JR

U
Unacademy user
  1. NTA UGC NET Paper -2


  2. Computer Science & Application


  3. About Me Sandeep M.Tech (IT) from IIIT CSIR (Engineering Science) as JRF UGC NET (JRF) - Computer Science & Applications Worked as Software Engineer & Research Scientist


  4. Object - Oriented Programming


  5. Part 10


  6. unacademy Follow me on the Unacademy Learning App 127.1k Sandeep Singh Educator since May 201 Co-founder of BSI Academy. 5 years of teaching Qualified in UGC NET in Computer Science and its Get updates about new courses Watch all my lessons Application as JRF& lecturer 14.7k 0 34 Follow . Download slides and watch offline All courses Q Sandeep Singh HINDI Programming in C&C (Hindi) Concepts of Objects Oriented Programming: CBSE UGC NET 0(6 ratings Sandeep Singh


  7. Dynamic Memory Allocation The new and delete operators are used to allocate and free memory at run time. The new operator allocates memory and returns a pointer to the start of it.


  8. Dynamic Memory Allocation The general forms of new and delete are shown here: pvar new type delete p_var; Here, p. var is a pointer variable that receives a pointer to memory that is large enough to hold an item of type type.


  9. Heap The dynamic memory allocation happens on the heap. Heap is a memory space which grows or shrinks dynamically.


  10. Memory Allocation in Heap Whenever the memory is allocated dynamically for any object, a space is allocated in the heap. This allocation remains until it is deleted (freed)


  11. #include <iostream> using namespace std; class Box { public: Box() cout << "Constructor called!" <<endl; Box() cout << "Destructor called!" <<endl; int main() f Box* myBoxArray new Box [4]; delete [] myBoxArray; // Delete array return 0;


  12. Example of Memory Leak // Example of Memory leak int main(int argc, char** argv) { Trainee* poT1-new Trainee(); poT1->SetData(102,"Dave",1200,350); poT1->CalculateSal(); return 0;