answersLogoWhite

0

Constructors are necessary to initialize classes. It allows to avoid to a lot of problems with unauthorized access of memory.

Dynamic allocation makes possible allocation of memory during execution of program. If you do not use dynamic allocation, all required memory will be allocated during initialization phase (constructors are usually responsible for that). But you can't use more memory. Dynamic allocation was designed to overcome such problems.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is the opposite of dynamic allocation?

The opposite of dynamic is static.


Differentiate between static allocation and dynamic allocation?

BS Anwer- static allocation is when something is moved to a location permanantally and dynamic allocation is when something is moved temporarily, but will move again.


What is a dynamic constructor?

dynamic constructor is a way to constructing an object based on the run type of some existing object. it basically uses standard virtual functions/polymorphism


What Linked list uses.type of memory allocation?

Linked lists use dynamic memory allocation (also called "heap memory allocation", as the linked list is stored in heap memory).


What is difference in static and dynamic storage allocation?

Static storage allocation is when a program dedicates an amount of memory for its use at the start of the program. Dynamic storage allocation is when a program only takes storage as it needs it.


What are the two methods of representing a binary tree?

Two method of representing a binary tree is Static allocation, and Dynamic allocation


Compare and contrast dynamic memory allocation and the allocation of files in secondary storage?

Static Memory Allocation: Allocating the total memory requirements that a data structure might need all at once without regard for the actual amount needed at execution time. Dynamic Memory Allocation: The opposite strategy of static memory allocation - Dynamic Memory Allocation, involves allocating memory as-needed.


What are types of memory allocation?

There are two types of memory allocations. 1. Static memory allocation 2. Dynamic memory allocation


How do you display matrix in c using dynamic memory allocation?

Memory allocation is not necessary to display a matrix.


What is the special features of pointers in c?

Dynamic memory allocation


Why pointer of constructor is made but not of destructor?

When a constructor is invoked dynamically, the new operator allocates the required memory, initialises it according to the constructor, then returns a pointer to the allocation. The destructor is invoked by deleting the pointer. It wouldn't make any sense to return a pointer from a deletion.


What is use of constructor in java?

Constructor is used to do something (written in constructor) immediately after object creation.