Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReUsing variables

Status
Not open for further replies.

Zarcom

Programmer
May 7, 2002
1,275
CA
for example I have this

dim myTableCell as TableCell

'use table cell

buncha code

'use table cell

buncha code

'use table cell


Is it better to do a myTableCell = New TableCell() each time or to use a completely different variable. My question came from the fact that when I am done with table cell I like to do a myTableCell = Nothing. Even without it I believe that when you do = New TableCell() it causes late binding, which is slower than early binding right?

So is it better to think up new names for each instance of a class type or is it ok to reuse the same variable by reinstanciating.

Discuss That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I think it makes sense to reuse the variable name for multiple instances of a class type.

since the variable is merely a POINTER to the actual object (i.e. when you say varCell = New TableCell() you're really saying "varCell points to this address where the TableCell object lives"), changing the address of the pointer would be much easier than creating a whole whack of pointers sitting in memory.

D'Arcy
 
hmm This is true. Thanks for the viewpoint D That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top