If one won''t explicitly call the destructor of a local then , C/C++ Programming

Assignment Help:

if one won't explicitly call the destructor of a local; then how does he handle the above situation?


Related Discussions:- If one won''t explicitly call the destructor of a local then

Miniumshelf, write a prgm to find minimum total number of shelves including...

write a prgm to find minimum total number of shelves including the intial one required for loading process

Using the substitution model illustrate the process, Each of the following ...

Each of the following two procedures defines a method for adding two positive integers in terms of the procedures inc, which increments its argument by 1, and dec, which decrements

Computer Science 101, This is what I need help with. "Create a program cre...

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

Explain passing and returning objects, Passing and Returning Objects Ob...

Passing and Returning Objects Objects can be passed to a function and returned back just like normal variables. When an object is passed by content, the compiler makes another

Arrays and pointers, i have an array of structs, and am trying to make a po...

i have an array of structs, and am trying to make a pointer that can point to a certain struct within the array

Program to compute distance travelled by ball, Produce a pseudo code to be ...

Produce a pseudo code to be used for development compute and display some data on the bounces a ball will make when dropped from a given height. To simplify the problem, you ass

What is the best fit algorithm, The Best fit algorithm: The best fit metho...

The Best fit algorithm: The best fit method occurs the smallest free block whose size is greater than or equivalent to n. An algorithm to get such a block by traversing the whole

Library functions, is getchar() is a C++ library function?

is getchar() is a C++ library function?

3/15/2013 5:27:11 AM

if one won''t explicitly call the destructor of a local; then how does he handle the above situation?

A: Just wrap the extent of the lifetime of the local in an artificial block {...}:

void someCode()

{

{

 

File f;

...insert code which should execute while f is still open...

} f''s destructor will automatically be called here.

...insert code here which should execute after f is closed...}

 

3/15/2013 5:33:02 AM

if one won''t explicitly call the destructor of a local; then how does he handle the above situation?

A: Just wrap the extent of the lifetime of the local in an artificial block {...}:

void someCode()

{

{

 

File f;

...insert code which should execute while f is still open...

} f''s destructor will automatically be called here.

...insert code here which should execute after f is closed...}

 

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