Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

static C C++ÓïÒå

´æ´¢ÆÚstorage duration(extent)£¬ ָΪ¶ÔÏóÅäÖõÄÄÚ´æµÄ´æ»îÆÚ£¬±ÈÈçlocal extent
Éú´æ¿Õ¼äscope£¬Ö¸¶ÔÏóÔÚ³ÌÐòÄڵĴæ»îÇøÓò£¬¼´¿É±»·ÃÎʵķ¶Î§£¬±ÈÈçfile scope, static scope, local scope
C
local static object
 º¯ÊýÄÚ²¿µÄobject£¬¾ßÓÐlocal scope£¬µ«ÊÇÿ´Îº¯Êý±»µ÷Óúó¸Ã¶ÔÏóµÄÄÚ´æ²»ÇåÀí£¬µ½Ï´ε÷Óû¹±£³ÖÔ­×´
file static oject£¬static function
 Ö»Óб»±àÒëÎļþµÄÉùÃ÷µãÖ®ºó²ÅÄÜʹÓøÃobjectºÍ¸Ãfunciton£¬´ïµ½Òþ²ØÍⲿ¶ÔÏóµÄÄ¿µÄ
 
C++
Ö±½Ó¶¨ÒåÔÚÎļþÖеıäÁ¿(ÎÞÂÛÊÇ·ñ¼Óstatic)£¬¾ßÓÐfile scope£¬¼´static scope£¬ÄÚ´æÒ»Ö±µ½³ÌÐò½áÊø²ÅÊÍ·Å
local static object
 º¯ÊýÄÚ²¿µÄobject£¬¾ßÓÐlocal scope£¬µ«ÊÇÿ´Îº¯Êý±»µ÷Óúó¸Ã¶ÔÏóµÄÄÚ´æ²»ÇåÀí£¬µ½Ï´ε÷Óû¹±£³ÖÔ­×´
static class member
 classÄÚΨһµÄÒ»·Ý(¼´¸ú¶ÔÏóÎÞ¹Ø)£¬¿É¹²ÏíµÄ£¬member
const static class member
 Í¬static class member£¬µ«ÊÇ¿ÉÇÒ½ö¿ÉÔÚÉùÃ÷ʱ¸³Öµ
static class functions
 ²»´æÈ¡ÈκÎnon-static membersµÄº¯Êý
#pragma once
#include <string>
using namespace std;
class MyClass1
{
public:
MyClass1(void);
~MyClass1(void);
static void Test(void); //static class function
private:
static string _name; //static class member
static int _age; //static class member
int _testi;
const static int _size = 1; //const static class member
};
static int mytest2i = 0;
#include "StdAfx.h"
#include "MyClass1.h"
int MyClass1::_age;
string MyClass1::_name = "test"; //initialize here
MyClass1::MyClass1(void)
{
mytest2i = 0;
}
MyClass1::~MyClass1(void)
{
}
void MyClass1::Test(void)
{
MyClass1::_age = 1;
}  


Ïà¹ØÎĵµ£º

JavaºÍC++λÔËËã¶Ô±È

ΪÁËʵÏÖÁ½¸öÊý×Ö½øÐн»»»£¬ÎÒÃÇͨ³£¿ÉÒÔÀûÓÃλÔËËãÀ´ÊµÏÖ
C++³ÌÐò     swap(int a  ,int b){a^=b^=a^=b;}
JAVA³ÌÐò    swap(int a, int b){  a^=b;b^=a;a^=b; }»òÕß{ b^=(a^=b) ; a^=b;}
Èç¹ûJAVAÓÃC++µÄʵÏÖ·½Ê½Ôò»áµÃµ½ bµÃµ½ÁËaµÄÖµ£¬µ«ÊÇaÏÖÔÚµÄֵȴ² ......

ÓÃCÓïÑÔÀ©Õ¹PythonµÄ¹¦ÄÜ

µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëÑ°ÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓ⻶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ­²¿ÊðÔÚÐí¶à¹Ø¼ ......

c/C++ÄÚ´æ·ÖÅä—new£¬malloc£¬GlobalAllocÏê½â

                    
                    C++ÄÚ´æ·ÖÅäÃؼ®—new£¬malloc£¬GlobalAllocÏê½â
  ......

CÓïÑÔº¯ÊýµÄ³ö¿Ú:returnÓï¾ä£¨¸ßÖÊÁ¿c/c++±à³ÌÖ¸ÄÏ£©


CÓïÑÔº¯ÊýµÄ³ö¿Ú:returnÓï¾ä£¨¸ßÖÊÁ¿c/c++±à³ÌÖ¸ÄÏ£© ÊÕ²Ø
½ñÌì¿´µ½ÁËһƪ¹ØÓÚc/c++ÓïÑÔÖÐ,¶ÔÓÚº¯Êý³ö¿Ú´¦:returnÓï¾äµÄÕýÈ·ÐÔºÍЧÂÊÐԵļì²éÎÊÌ⡣ƽʱÎÒÃǶ¼²»Ì«¿´ÖØreturnÓï¾äµÄ£¬ÈÏΪËü¼òµ¥£¬²»ÊǺÜÖØÒª£¬Æäʵ²»È»£¬returnÓï¾äÒªÊÇдµÄ²»ºÃ£¬ºÜÈÝÒ×µ¼ÖÂЧÂʵÍÏ£¬ÉõÖÁ»á³ö´í£¡ÌرðÊÇÔÚ´¦ÀíÖ¸Õëʱ¡£
ÏÂÃæ¿´¿´Òª ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ