易截截图软件、单文件、免安装、纯绿色、仅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;
}  


相关文档:

mysql connect by c++

#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field; ......

Python嵌入C++详解(3)

继前篇《Import Module》(http://blog.csdn.net/xiadasong007/archive/2009/09/02/4512797.aspx),继续分析嵌入部分基础知识。这次不多说,有什么问题记得多查英文资料,国内的这方面知识少
还是来看代码,写完我就睡觉了~
 
#include "python/python.h"
#include <iostream>
using namespace std;
int ......

C++中使用sqlite

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
 
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
    int i;
    for ( i=0; i<argc; i++ )
   ......

Delphi 与 C/C++ 数据类型对照表

Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......

c/C++内存分配—new,malloc,GlobalAlloc详解

                    
                    C++内存分配秘籍—new,malloc,GlobalAlloc详解
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号