q-what is your reaction to following line of


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

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: q-what is your reaction to following line of
Reference No:- TGS0217908

Expected delivery within 24 Hours