What is your reaction to following line of code? , C/C++ Programming

Q-What is your reaction to following line of code?

              delete this;

A: This is not a good programming Practice. A good programmer will insist that you must absolutely never employ the statement if the class is to be utilized by other programmer's instantiated as extern, static or automatic objects. That much must be obvious. The code contains two built-in pitfalls. First one, if it executes in a member function for an static, extern or automatic object, the program will perhaps crash immediately the delete statement executes. There is no portable method for an object to tell that it was instantiated on the heap, thus the class cannot assert that its object is correctly instantiated. Second one, while an

 

Posted Date: 3/20/2013 8:19:36 AM | Location : United States







Related Discussions:- What is your reaction to following line of code? , Assignment Help, Ask Question on What is your reaction to following line of code? , Get Answer, Expert's Help, What is your reaction to following line of code? Discussions

Write discussion on What is your reaction to following line of code?
Your posts are moderated
Related Questions
A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Program to sort a range of numbers with Insertion: /* define variable */ const int max=29000; int list[max]; FILE *fp; clock_t start,end; char any1[8];

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

simple coding for pebble merchant..

smugglers transfer the messages from one to another by using the mobile

A: Name mangling is the rule according to which C++ modify function's name into function signature before passing that function to a linker. It is how the linker differentiates amo

1. The management of a company would like to determine the median annual salary of its employees.Write a pascal program that display the number of employees and their median salary

write a program that would accept the radius of the sphere and return its surface area.

A:BinaryHeap.h ------------ #ifndef BINARY_HEAP_H_ #define BINARY_HEAP_H_ #include "dsexceptions.h" #include "vector.h" // BinaryHeap class // CONSTRUCTION: wi

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec