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
Friend for Overloading Operators Sometimes friend functions cannot be avoided. For example with the operator overloading. Consider the following class that have data members to

v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0

Write a program that reads a line of characters from the user and displays that entire line after converting any uppercase characters to lowercase also change any lowercase charact

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

need some help with finishing a program

The ability to verify at run time the type of an object by using the typed operator or the dynamic_cast operator.

Project Description: I want a person who will be able to program a flex PCB for my device as i meet the person i will be able to describe all my needs Skills required are C P


write a program to accept ten numbers and display the total

where to use tower of honoi?