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
C Program for ADD,SUB,MUL,DIV,REM void main() {   int a,b,c,ch=0;           clrscr();           while(ch           { printf(" \n\n 1:- For To Add\n 2:- For

write a c program chat illustrates the creation of child process using fork system call. One process finds sum of even series and other process finds sum of odd series.

1.jewels can only be removed for polishing from either end of the necklace. 2.cost of polishing=sitting number*colour value of jewels.


Q: How can one encourage his (older) compiler to check new to see automatically if it returns NULL?       A: His compiler eventually will. If he contain an old compiler wh

a program to determine whether a number is an odd or even using recursive function

how made a flow chart of prime number by using for loop

The video game machines at your local arcade output coupons depending on how well you played the game, you can redeem 10 coupons for a candy bar, 6 coupons for .a medium soft drink

The question description: You are required to make a C++ program to conduct timber component (beam and column) structural design according to EC5 (all the relevant design codes

Introduction to Classes Object-oriented programming (OOP) is a conceptual approach to design programs. It can be executed in many languages, whether they directly support OOP c