C static
CÓïÑÔ³ÌÐò¿ÉÒÔ¿´³ÉÓÉһϵÁÐÍⲿ¶ÔÏ󹹳ɣ¬ÕâЩÍⲿ¶ÔÏó¿ÉÄÜÊDZäÁ¿»òº¯Êý¡£¶øÄÚ²¿±äÁ¿ÊÇÖ¸¶¨ÒåÔÚº¯ÊýÄÚ²¿µÄº¯Êý²ÎÊý¼°±äÁ¿¡£Íⲿ±äÁ¿¶¨ÒåÔÚº¯ÊýÖ®Í⣬Òò´Ë¿ÉÒÔÔÚÐí¶àº¯ÊýÖÐʹÓá£ÓÉÓÚCÓïÑÔ²»ÔÊÐíÔÚÒ»¸öº¯ÊýÖж¨ÒåÆäËüº¯Êý£¬Òò´Ëº¯Êý±¾ÉíÖ»ÄÜÊÇ“ÍⲿµÄ”¡£
ÓÉÓÚCÓïÑÔ´úÂëÊÇÒÔÎļþΪµ¥Î»À´×éÖ¯µÄ£¬ÔÚÒ»¸öÔ´³ÌÐòËùÓÐÔ´ÎļþÖУ¬Ò»¸öÍⲿ±äÁ¿»òº¯ÊýÖ»ÄÜÔÚij¸öÎļþÖж¨ÒåÒ»´Î£¬¶øÆäËüÎļþ¿ÉÒÔͨ¹ýexternÉùÃ÷À´·ÃÎÊËü£¨¶¨ÒåÍⲿ±äÁ¿»òº¯ÊýµÄÔ´ÎļþÖÐÒ²¿ÉÒÔ°üº¬¶Ô¸ÃÍⲿ±äÁ¿µÄexternÉùÃ÷£©¡£
¶østaticÔò¿ÉÒÔÏÞ¶¨±äÁ¿»òº¯ÊýΪ¾²Ì¬´æ´¢¡£Èç¹ûÓÃstaticÏÞ¶¨Íⲿ±äÁ¿Ó뺯Êý£¬Ôò¿ÉÒÔ½«¸Ã¶ÔÏóµÄ×÷ÓÃÓòÏÞ¶¨Îª±»±àÒëÔ´ÎļþµÄÊ£Óಿ·Ö¡£Í¨¹ýstaticÏÞ¶¨Íⲿ¶ÔÏ󣬿ÉÒÔ´ïµ½Òþ²ØÍⲿ¶ÔÏóµÄÄ¿µÄ¡£Òò¶ø£¬staticÏÞ¶¨µÄ±äÁ¿»òº¯Êý²»»áºÍͬһ³ÌÐòÖÐÆäËüÎļþÖÐͬÃûµÄÏà³åÍ»¡£Èç¹ûÓÃstaticÏÞ¶¨ÄÚ²¿±äÁ¿£¬Ôò¸Ã±äÁ¿´Ó³ÌÐòÒ»¿ªÊ¼¾ÍÓµÓÐÄڴ棬²»»áËæÆäËùÔÚº¯ÊýµÄµ÷ÓúÍÍ˳ö¶ø·ÖÅäºÍÏûʧ¡£
CÓïÑÔÖÐʹÓþ²Ì¬º¯ÊýµÄºÃ´¦£º
¾²Ì¬º¯Êý»á±»×Ô¶¯·ÖÅäÔÚÒ»¸öһֱʹÓõĴ洢Çø£¬Ö±µ½Í˳öÓ¦ÓóÌÐòʵÀý£¬±ÜÃâÁ˵÷Óú¯Êýʱѹջ³öÕ»£¬ËٶȿìºÜ¶à¡£
¹Ø¼ü×Ö“static”£¬Òë³ÉÖÐÎľÍÊÇ“¾²Ì¬µÄ”£¬ËùÒÔÄÚ²¿º¯ÊýÓֳƾ²Ì¬º¯Êý¡£µ«´Ë´¦“static”µÄº¬Òå²»ÊÇÖ¸´æ´¢·½Ê½£¬¶øÊÇÖ¸¶Ôº¯ÊýµÄ×÷ÓÃÓò½ö¾ÖÏÞÓÚ±¾Îļþ¡£ ʹÓÃÄÚ²¿º¯ÊýµÄºÃ´¦ÊÇ£º²»Í¬µÄÈ˱àд²»Í¬µÄº¯Êýʱ£¬²»Óõ£ÐÄ×Ô¼º¶¨ÒåµÄº¯Êý£¬ÊÇ·ñ»áÓëÆäËüÎļþÖеĺ¯ÊýͬÃû£¬ÒòΪͬÃûҲûÓйØϵ¡£
cÓïÑÔÖÐstaticµÄÓïÒå
1.static±äÁ¿:
1).¾Ö²¿
a.¾²Ì¬¾Ö²¿±äÁ¿ÔÚº¯ÊýÄÚ¶¨Òå,Éú´æÆÚΪÕû¸öÔ´³ÌÐò£¬µ«×÷ÓÃÓòÓë×Ô¶¯±äÁ¿Ïàͬ£¬Ö»ÄÜÔÚ¶¨Òå¸Ã±äÁ¿µÄº¯ÊýÄÚʹÓá£Í˳ö¸Ãº¯Êýºó£¬ ¾¡¹Ü¸Ã±äÁ¿»¹¼ÌÐø´æÔÚ£¬µ«²»ÄÜʹÓÃËü¡£
b.¶Ô»ù±¾ÀàÐ͵ľ²Ì¬¾Ö²¿±äÁ¿ÈôÔÚ˵Ã÷ʱδ¸³ÒÔ³õÖµ£¬Ôòϵͳ×Ô¶¯¸³Óè0Öµ¡£¶ø¶Ô×Ô¶¯±äÁ¿²»¸³³õÖµ£¬ÔòÆäÖµÊDz»¶¨µÄ¡£
2).È«¾Ö
È«¾Ö±äÁ¿±¾Éí¾ÍÊǾ²Ì¬´æ´¢·½Ê½£¬ ¾²Ì¬È«¾Ö±äÁ¿µ±È»Ò²ÊǾ²Ì¬´æ´¢·½Ê½¡£µ«ÊÇËûÃǵÄ×÷ÓÃÓò£¬·Ç¾²Ì¬È«¾Ö ±äÁ¿µÄ×÷ÓÃÓòÊÇÕû¸öÔ´³ÌÐò£¨¶à¸öÔ´Îļþ¿ÉÒÔ¹²Í¬Ê¹Óã©£» ¶ø¾²Ì¬È«¾Ö±äÁ¿ÔòÏÞÖÆÁËÆä×÷ÓÃÓò£¬ ¼´Ö»ÔÚ¶¨Òå¸Ã±äÁ¿µÄÔ´ÎļþÄÚÓÐЧ£¬ ÔÚͬһԴ³ÌÐòµÄÆäËüÔ´ÎļþÖв»ÄÜʹÓÃËü¡£
2.staticº¯Êý£¨Ò²½
Ïà¹ØÎĵµ£º
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "Ö´Ðй¹Ô캯Êý´´½¨Ò»¸ö¶ÔÏó" << endl;
}
A(A&){
cout << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......
ºÃ¾ÃÒÔÇ°×öµÄÒ»¸ö³ÌÐò£¬Ì°ÐIJßÂÔʵÏÖ±³°üÎÊÌ⣬cʵÏÖ¡£
×ܽáÔÚÕâÀÒÔ±¸ÒÔºóºÍ±ðÈ˲éÕÒ¡£
//±³°üÎÊÌâ
#include "stdio.h"
#define MAX 10
void main()
{
int w[MAX]={0,10,130,15,60,25}; //´æ·ÅÖÊÁ¿
int v[MAX]={0,30,5,10,20,25}; //´æ·Å¼ÛÖµ
flo ......
oracleÖÐpro*cµÄѧϰ
¡¡Ò» Pro*C ³ÌÐò¸ÅÊö£º
1£®Ê²Ã´ÊÇPro*C³ÌÐò
ÔÚORACLEÊý¾Ý¿â¹ÜÀíºÍϵͳÖУ¬ ÓÐÈýÖÖ·ÃÎÊÊý¾Ý¿âµÄ·½·¨£»
£¨1£© ÓÃSQL*Plus£¬ ËüÓÐSQLÃüÁîÒÔ½»»¥µÄÓ¦ÓóÌÐò·ÃÎÊÊý¾Ý¿â£»
£¨2£© ÓõÚËÄ´úÓïÑÔÓ¦Óÿª·¢¹¤¾ß¿ª·¢µÄÓ¦ÓóÌÐò·ÃÎÊÊý¾Ý¿â£¬ÕâЩ¹¤¾ßÓÐSQL*froms£¬QL*Reportwriter,SQL*MenuµÈ£»
£¨3£© ÀûÓÃÔÚ ......
1£© º¯ÊýÉùÃ÷
l CÈç¹û²»Ð´·µ»ØÖµ£¬Ä¬ÈÏÊÇint£¬¶øC++Öв»Äܲ»Ð´·µ»ØÖµ(¿ÉÓÃvoid±íʾÎÞ·µ»ØÖµ)¡£
ÈçFunc1();
l int Func1()ÔÚCÖбíʾ¿É´øÈÎÒâ²ÎÊýµÄº¯Êý£¬ÕâÊÇCµÄ©¶´£¬Ê¹µÃËü±Ü¿ªÁ˲ÎÊýÀàÐͼì²é£»¶øC++Öбíʾ²»´ ......
´ÓijλÍøÓѵIJ©¿Í¿´µ½¹ØÓÚextern "C"Ó÷¨µÄÎÄÕ£¬½²µÃ·Ç³£Í¸³¹£¬ÓÚÊǾÍÕª³ÁËÎÒ֮ǰ²»ÉõÁ˽âµÄ²¿·Ö×ö¸öbackup¡£
Ò»¡¢´ÓCÓëC++±àÒëÁ¬½Ó·½Ê½ÉîÈëÀí½âextern "C"
<1>.CºÍC++¶Ôº¯ÊýµÄ´¦Àí·½Ê½ÊDz»Í¬µÄ.±»extern "C"ÐÞÊεıäÁ¿ºÍº¯ÊýÊÇ°´ÕÕCÓïÑÔ·½Ê½±àÒëºÍÁ¬½ÓµÄ.extern "C"ÓÃÓÚʵÏÖC++ÓëC¼°ÆäËüÓïÑԵĻìºÏ±à³Ì¡ ......