<head> <title>static keyword</title> </head> <body bgcolor="#cccccc"> <font color=brown> <hr> <center><h1>static keyword</h1></center> <hr> <p> The <b>static</b> keyword has been extended in C++ to have the following meanings. <p> <table bgcolor="ivory" border=2> <th>C++ Context</th> <th>Action</th> <tr> <td> A variable outside of a function. </td> <td> Variable can be seen by all functions in the file. Default. </td> </tr> <tr> <td> Variable inside a function. </td> <td> The variable is permanent. The variable can only be initalised once and only one copy of the variable exists. Recursive calls use the same variable. </td> </tr> <tr> <td> A class member variable </td> <td> Only one copy of the variable exists. All instances of the object use the same variable (memory location). </td> </tr> <tr> <td> A class member function (method). </td> <td> Function can only access static members of the class </td> </tr> </table> <p> <hr> <a href="../../C/SYNTAX/storage_class.html#static">Here is the way static works in C</a> <hr> <h2>Examples:</h2> <img src="../../GRAPHICS/computer.gif"> <a href="../EXAMPLES/static.cc">No example programs yet.</a> <hr> <h2>See Also:</h2> <hr> </font> <font color=black> <h2>C References</h2> <p> <hr> <p> <center> <table border=2 width="80%" bgcolor="ivory"> <tr align=center> <td width="25%"> <a href="../cref.html">Top</a> </td><td width="25%"> <a href="../../C/master_index.html">Master Index</a> </td><td width="25%"> <a href="keywords.html">C++ Keywords</a> </td><td width="25%"> <a href="../../cref/FUNCTIONS/funcref.htm">Functions</a> </td> </tr> </table> </center> <p> <hr> <address><a href="../../address.html">Martin Leslie</a> 08-Dec-96</address>
file: /Techref/language/ccpp/cppref/SYNTAX/static.htm, 1KB, , updated: 2018/7/27 12:20, local time: 2024/11/21 16:50,
3.144.252.58:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/language/ccpp/cppref/SYNTAX/static.htm"> static keyword</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.