Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > doubt on scope of pointers VERY URGENT!!!!!!!!! PLEASE HELP ME.........

Reply
Thread Tools

doubt on scope of pointers VERY URGENT!!!!!!!!! PLEASE HELP ME.........

 
 
edu.mvk
Guest
Posts: n/a
 
      07-10-2006
Hi ,

if the program is like this ...

please tell me the scope of the "ptr" and the vector "vec_ptr"...

class A
{
private :
vector< B* > vec_ptf ;
public :
init();
shutdown();
}

A :: init()
{
B *ptr;
int i=0;
while( i < 10 )
{
ptr = new B();
vec_ptr.push_back( ptr );
}
}

A :: shutdown()
{
if ( !vec_ptr.empty() )
{
vector<B*>::iterator B_Iterator;
for( B_Iterator = vec_ptr.begin(); B_Iterator !=
vec_ptr.end(); B_Iterator++ )
{
delete( vec_ptr[QCop_Iterator] );
}
}
}

if i have declared and instantiated the " ptr " in the function init()
like above and after pushing that into the vector of type B* will the
object be remain even in the shutdown() function....??

please tell me the scope of that pointer ptr and the vector that
containing the ptr.


Tthanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointers, pointers, pointers... cerr C Programming 12 04-07-2011 11:17 PM
Help running a very very very simple code olivier.melcher Java 8 05-12-2008 07:51 PM
doubt on scope of pointers VERY URGENT!!!!!!!!! PLEASE HELP ME......... edu.mvk C++ 2 07-10-2006 08:23 AM
doubt on scope of pointers VERY URGENT!!!!!!!!! PLEASE HELP ME......... edu.mvk C++ 0 07-10-2006 07:39 AM
Quick Book file access very very very slow Thomas Reed Computer Support 7 04-09-2004 08:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57