answersLogoWhite

0

The only way to delete objects in an object oriented programming language (unless they were created in heap memory) is for the object to go out of scope. If the object is declared in the heap, in c++ you would use delete[] ptr; or delete ptr; where ptr is a pointer to your object.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Who is the inventor of Reverse Delete Algorithm for MST When was this first published?

The Reverse Delete Algorithm for finding the Minimum Spanning Tree was first introduced by Edsger Dijkstra in 1959. He presented this algorithm in his paper titled "A note on two problems in connexion with graphs" which was published in Numerische Mathematik.


Write an Algorithm to delete a last element from the array?

// Assuming you dynamically allocated this array using "new"... delete array[arraysize - 1]; arraysize--;


What is the worst case running time of algorithm to delete each element from the linked list?

Linear time. O(n).


What is the process of implementing the heap delete algorithm in data structures and algorithms?

The process of implementing the heap delete algorithm involves removing the root node from the heap, replacing it with the last node, and then reorganizing the heap to maintain the heap property. This typically involves comparing the node with its children and swapping it with the larger child if necessary, repeating this process until the heap property is restored.


An algorithm of deleting linked list?

To delete a linked list walk through the list and delete the memory allocated to each element, remembering the next element address, and then iterating or recursing the process using the next element address, until the next element address is null.


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


Which algorithm is more efficient lamport bakery algorithm or black and white bakery algorithm?

Black and White bakery algorithm is more efficient.


What is complsexity of an algorithm?

Complexity of an algorithm is a measure of how long an algorithm would take to complete given


How do you test algorithm?

By preparing test cases we can test an algorithm. The algorithm is tested with each test case.


List down the names of any three parameters on which you analyze an algorithm?

what is algorithm and its use there and analyze an algorithm


How algorithm is different from flowchart?

An algorithm is a series of steps leading to a result. A flowchart can be a graphical representation of the algorithm.


Define algorithm and explain its criteria?

algorithm criteria


How are expanded algorithm and the standard algorithm different?

Yes


What is algorithm evaluation?

evaluation iz same as the testing of an algorithm. it mainly refers to the finding of errors by processing an algorithm..


What is algorithm write properties of algorithm?

An ALGORITHM is a sequence of steps that depicts the program logic independent of the language in which it is to be implemented. An algorithm should be designed with space and time complexities in mind.


Is Dijkstra's algorithm a greedy algorithm?

Yes, Dijkstra's algorithm is a greedy algorithm because it makes decisions based on the current best option without considering future consequences.


Give 10 difference between dda and bresenham algorithm?

DDA algorithm involves floating-point operations, while Bresenham algorithm uses only integer operations. DDA algorithm calculates the exact position of each pixel, while Bresenham algorithm determines the closest pixel to the ideal line path. DDA algorithm can suffer from precision issues due to floating-point calculations, while Bresenham algorithm is more accurate and efficient. DDA algorithm is simpler to implement but slower than Bresenham algorithm. DDA algorithm is susceptible to rounding errors, while Bresenham algorithm is not. DDA algorithm can produce jagged lines due to rounding errors, while Bresenham algorithm generates smoother lines. DDA algorithm is suitable for both lines and circles, while Bresenham algorithm is primarily used for drawing lines. DDA algorithm can handle lines with any slope, while Bresenham algorithm is more efficient for lines with slopes close to 0 or 1. DDA algorithm involves multiplication and division operations, while Bresenham algorithm uses addition and subtraction operations. DDA algorithm is a general line drawing algorithm, while Bresenham algorithm is specialized for line drawing and rasterization.


What is the Graham scan algorithm?

An algorithm for constructing the convex hull


What do you call an 'algorithm' in sanskrit?

In Sanskrit, 'prameya' is the word for algorithm.


What is the Euclid's Algorithm to simplify fractions?

it is euclidean algorithm...