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

Assignment Help:

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

 


Related Discussions:- What is your reaction to following line of code?

Decode the code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Car rental payment system, payment system, in c++ only..just use the printf...

payment system, in c++ only..just use the printf or scanf.please

Constructor and destructor function with derived classes, Constructor and D...

Constructor and Destructor function with derived classes If there are constructors included in the base class and the derived class, the compiler automatically calls both of th

#title minimization and maxmization assignment problem, how we can code in ...

how we can code in c++ for assignment problem (operation research) method to mkinimization and mamization

Define functions with arguments and no return values, Define Functions with...

Define Functions with arguments and no return values The calling function will read a data from the terminal and pass it on to called as function and this will work good as the

C program to read the contents of a file, Program is to read the contents o...

Program is to read the contents of a file: void main()    {   ifstream fin("ascii.txt");   char ch;   while(! fin.eof())     {   fin>>ch;   cout     }

C program count characters words with space & without space , v\:* {behavio...

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

Member dereferencing operators, M em b e r d e r e f e r e n c ...

M em b e r d e r e f e r e n c i ng o p e r a t o r s: T h e s e op e r a t o r s w i l l b e d i s c u s s e d l a t

Algorithm, Write an algorithm to print all even numbers in descending order...

Write an algorithm to print all even numbers in descending order and draw the flowchart.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd