TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: Neil Heller
from: Jasen Betts
date: 2003-09-04 07:12:04
subject: Static vars in functions

Hi Neil.

02-Sep-03 14:32:00, Neil Heller wrote to All


 NH> If there is a static variable in a methodology of a class, does
 NH> that variable get re-initialized with each new instance of the
 NH> class?

statics go in the initialised data you get one per coded instance.
so it only gets initialised once (by the compiler, not by application
code) unless you code additional initialisations.

 NH> Does IntVar in pfoo->SomeFunc() get reinitialized to zero with
 NH> each new instance of class foo or is it initialized only once per
 NH> application?

once per aplication AFAICT, /if/ you want it with every instance do it
explicitly in the constructor.

---
* Origin: Entropy isn't what it used to be. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.