TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: WIM VELDHUIS
from: CAMERON CLARK
date: 1997-04-15 16:40:00
subject: Re: Static?

WV> As usual there is more to a word than only its meaning. Words can only be
WV> understood correctly when they are seen in the context in which they are 
us
    In c++, static can have a few implied meanings. 
    #1 a static int member in a class
       Say you have an array of students. Each student has a grade.
       Each student object also has a lowest limit for the grade and
       still be passing.
       class student {
         int grade;
         static int minimum_passing;
       }
       int student::minimum_passing = 50;
       In this case, all students share the ONE integer for minimum_passing
       grade. The value, also, may only be set once.
    #2 a static member function
       class something {
         static void do_something();
       };
       Normally to call do_something, you would have to have an object 
       first.
          something a;
          a.do_something();
       A static function can be called without an object.
         something::do_something();
    #3 a static int within a kernel
       In an operating system, you may not want certain data structures
       to be allocated/deallocated on the fly. In this case static keeps
       the space for a data stuctures permenantly allocated to the program.
       In operating systems, like unix, many processes may share information
       and a static area withing the systems kernel can be used to share
       memory.
       
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

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