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?

Chelo, need some help with finishing a program

need some help with finishing a program

String program, Write a C++ program which does the following: 1. Asks th...

Write a C++ program which does the following: 1. Asks the user to enter the following text "Four score and seven years ago there was a man named Joey Bagadonuts." 2. Save thi

Define polymorphism?, Define Polymorphism? A: Polymorphism let a client ...

Define Polymorphism? A: Polymorphism let a client to treat distinct objects in the similar way even if they were developed from distinct classes and exhibit different behaviors.

Create a c project, The project will include Arena models (only .doe files)...

The project will include Arena models (only .doe files) and MSWord document for the report. Thereport must contain the following sections: 1. Introduction: (a)    Statemen

I need file transfer solution, We move a high quantity of large Video files...

We move a high quantity of large Video files (200mb - 2 GB each) across the internet. We have a Linux server (ubuntu) hosted in a datacenter (1Gbps) operating an FTP server. Our

Explain relational operators, Relational Operators A relational operato...

Relational Operators A relational operator is used to make comparison among two values. All these operators are binary and needs two operands. There are the following relationa

Operation on array - c program, Operation on array: void Array::add( O...

Operation on array: void Array::add( Object& toAdd ) {     lastElementIndex++;     while( ptrAt( lastElementIndex ) != ZERO &&            lastElementIndex

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