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

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

Posted Date: 3/15/2013 5:26:38 AM | Location : United States





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...}

 

Posted by | Posted Date: 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...}

 

Posted by | Posted Date: 3/15/2013 5:33:02 AM


Related Discussions:- If one won''t explicitly call the destructor of a local then , Assignment Help, Ask Question on If one won''t explicitly call the destructor of a local then , Get Answer, Expert's Help, If one won''t explicitly call the destructor of a local then Discussions

Write discussion on If one won''t explicitly call the destructor of a local then
Your posts are moderated
Related Questions

Get Reverse Engineer to Linux game routine analysis Project Description: I want a fast and efficient reverse engineer with good knowledge of assembly x86 language, strong rev

In this Lab you will code 8086 assembler equivalents (Virgo) for common C control flow instructions. This will give you an appreciation for how control flow is implemented in assem

Help for tomorrow...?

In POS system, cashier computer connect to printer using serial rs232 usb or cable. We need to capture data from that connection, and parsing the data to get total amount for every

write a program that counts the number of occurrences of the string in the n-th Padovan string P(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

Question Write a program using c++ for the above function , at a= 1000, b=10 -3 ,10 -2 ,10 -4

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

What is inheritance? Class, the vehicle, which is used to execute object-oriented concepts in C++, has given a new dimension to this idea of reusability. Many vendors now offer

WAP TO ACCEPT MARKS OF THREE SUBJECT FOR STUDENT & CALCULATE TOTAL MARKS AND PERCENTAGE #include stdio.h> #include conio.h>   void main() {            int M1,M