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

Recursive procedure to computes the number of digits, (a) Write a recursive...

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

Assingment help, can you help with the assignment, I don''t want to upload ...

can you help with the assignment, I don''t want to upload the assignment but want somebody to work with, do you do that?

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Fundamental input - output routines getc and putc, Access to the channel/de...

Access to the channel/devices is achieved by means of general purpose I/O routines Theses are standard functions described in stdio.h header file namely getc and putc. Getc and put

Write a program to design a leet speak translator, The program will consist...

The program will consist of two text fields, two buttons, and a counter label.  One text field will be input, where the user types the plain text.  The second text field will be ou

Day calculate b/w two dates, Write a function that calculates the number of...

Write a function that calculates the number of elapsed days between two dates. For example the days between Feb 3, 1970 and June 21, 1980? Becareful for the Leap year.

Explain reusability, Reusability  Reusability means reusing code writte...

Reusability  Reusability means reusing code written earlier, may be from some earlier project or from the library. Reusing old code not only saves development time, but also sa

C program to returns the string, Program is to take two arguments and retur...

Program is to take two arguments and returns the string: Program is to take two arguments and returns the string which is larger the larger string has larger ascii value invok

Input, I want to take 1.1 as input but when I am declaring it as float the ...

I want to take 1.1 as input but when I am declaring it as float the output is given as 1.1000000

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