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
##question.A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string co   program in jav

Can you think of a condition where your program would crash without attaining the breakball, which you set at the straining of main()? A: C++ let for dynamic initialization of g

I want MODI method''s coding in c++ using all concepts of c++..please help me its my project work...

there is a pebble merchant. he sells the pebbles,that are used for shining the floor.his main duty is to take the length of the room side but he sometines mistakes doing that and m

find wether specific word is inside a pool of word and what is the direction e.g. north

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole f

Program which can check the given string is super ascii or not

The Malt Shop restaurant charges $2.99 for burgers, $1.29 for fries, and $1.25 for sodas.  Write a program that allows a restaurant employee to enter an order (the number of bur

I need a project on car rental system using c programming only of college level

You have to write a subroutine (assembly language code using NASM) for the following equation.