DelphiÖÐʵÏÖC++/JavaÀàËƾ²Ì¬±äÁ¿µÄ¹¦ÄÜ
ÔÚÍøÉÏ¿´µ½ºÜ¶àÈ˶¼ÔÚΪDelphiÊÇ·ñÖ§³ÖC++/JavaÖеľ²Ì¬±äÁ¿¼°¾²Ì¬·½·¨µÄ¹¦ÄܶøÀ§ÈÅ,ÆäʵÕâÔÚDelphiÖÐÊǺܼòµ¥µÄ.
¾²Ì¬·½·¨¾ÍÊÇʹÓÃClass Function. ¾²Ì¬±äÁ¿ÔòʹÓõ¥Ôª¾Ö²¿±äÁ¿À´ÊµÏÖ. ´úÂëÈçÏÂ:
//=========================================
// StaticVarTestU - ¶¨ÒåÁË¿ÉÒÔ¼ÆÊýµÄÀ࣬ͨ¹ýÀà·½·¨¼´¿É·ÃÎÊ´ËÀàµÄ¶ÔÏóÊý
//=========================================
unit StaticVarTestU;
interface
type
TStaticVarClass = class
public
//constructor
constructor Create();
destructor Destroy; override;
//Àà·½·¨£¬È¡µÃ¶ÔÏóµÄ¼ÆÊý
class function ObjectCount: integer;
protected
private
end;
implementation
Var
LObjCount: integer;
{ TStaticVarClass }
constructor TStaticVarClass.Create;
begin
inc(LObjCount); //ʹÓþֲ¿±äÁ¿
end;
destructor TStaticVarClass.Destroy;
begin
dec(LObjCount); //ʹÓþֲ¿±äÁ¿
inherited;
end;
class function TStaticVarClass.ObjectCount: integer;
begin
Result := LObjCount; //·µ»Ø¾Ö²¿±äÁ¿
end;
initialization
LObjCount := 0; //³õʼ»¯
finalization
LObjCount := 0;
end.
//=========================================
// StaticTest - ²âÊÔ´úÂë,´´½¨10¸ö¶ÔÏó,²¢·ÃÎÊÆä¼ÆÊý,ÔÙFreeµô.
//=========================================
program StaticTest;
{$APPTYPE CONSOLE}
uses
SysUtils,
Classes,
StaticVarTestU in StaticVarTestU.pas;
procedure printObjCount;
begin
WriteLn(Format(The Object Count now is %d, [TStaticVarClass.ObjectCount]));
end;
var
i: integer;
mObjList: TList;
begin
{ TODO -oUser -cConsole Main : Insert code here }
mObjList := TList.Create;
printObjCount;
for i := 0 to 10 do
begin
mObjList.Add(TStaticVarClass.Create());
printObjCount;
end;
for i := 0 to mObjList.Count -1 do
begin
TStaticVarClass(mObjList.Items[i]).Free;
printObjCount;
end;
mObjList.Free;
readln;
end.
Ïà¹ØÎĵµ£º
1£®ÈçºÎѧϰ³ÌÐòÉè¼Æ£¿
JAVAÊÇÒ»ÖÖƽ̨£¬Ò²ÊÇÒ»ÖÖ³ÌÐòÉè¼ÆÓïÑÔ£¬ÈçºÎѧºÃ³ÌÐòÉè¼Æ²»½ö½öÊÊÓÃÓÚJAVA£¬¶ÔC++µÈÆäËû³ÌÐòÉè¼ÆÓïÑÔÒ²Ò»Ñù¹ÜÓá£Óбà³Ì¸ßÊÖÈÏΪ£¬ JAVAÒ²ºÃCÒ²ºÃûʲô·Ö±ð£¬ÄÃÀ´¾ÍÓá£ÎªÊ²Ã´ËûÃÇÄÜ´ïµ½Èç´Ë¾³½ç£¿ÎÒÏëÊÇÒòΪ±à³ÌÓïÑÔÖ®¼äÓй²Í¨Ö®´¦£¬Áì»áÁ˱à³ÌµÄ¾«Ë裬×ÔÈ»Äܹ»×öµ½Ò»Í¨°Ùͨ¡£ÈçºÎѧϰ³ÌÐòÉè¼ÆÀ ......
import java.util.*;
public class stack
{
private List list=new ArrayList();
private int index=0;
public void push(Object obj)
& ......
½ñÄê3ÔÂAmazon·¢²¼
ÁËеÄJava AWS
SDK
£¬Ö¼ÔÚ¼ò»¯Amazon EC2ÉϵÄJavaÓ¦Óÿª·¢¡£
Amazon EC2ÊǸö˽ÓеÄWeb Services£¬ÌṩÁËÔÆ»·¾³Ïµĵ¯ÐÔ¼ÆËãÄÜÁ¦¡£AWS SDKÖ¼ÔÚ¼ò»¯ÍøÂç¹æÄ££¨web-scale£©ÏµļÆËã¡£AWS Toolkit for
Eclipse
×Ô¶¯»¯ÁË¿ª·¢ÖÜÆڵĴó¶àÊý²½Ö裬±ÈÈçAmazon¼¯ÈºÉϵIJ¿Êð¡¢µ÷ÊÔ¡¢ÊµÀý¼ÓÔØÒÔ¼°Íø ......
ͨ³££¬¿Í»§Àà(clients of class)ͨ¹ýÀàµÄ½Ó¿Ú·ÃÎÊËüÌṩµÄ·þÎñ¡£ÓÐʱ£¬ÏÖÓеÄÀà(existing class)¿ÉÒÔÌṩ¿Í»§ÀàµÄ¹¦ÄÜÐèÒª£¬µ«ÊÇËüËùÌṩµÄ½Ó¿Ú²»Ò»¶¨ÊÇ¿Í»§ÀàËùÆÚÍûµÄ¡£ÕâÊÇÓÉÓÚÏÖÓеĽӿÚÌ«Ïêϸ»òÕßȱ·¦Ïêϸ»ò½Ó¿ÚµÄÃû³ÆÓë¿Í»§ÀàËù²éÕҵIJ»Í¬µÈÖî¶à²»Í¬ÔÒòµ¼Öµġ£
¡¡¡¡ÔÚÕâÖÖÇé¿öÏ£¬ÏÖÓеĽӿÚÐèҪת»¯(convert)Ϊ¿ ......
´Ójdk1.5¿ªÊ¼£¬JavaÖпªÊ¼Ö§³Ö·¶ÐÍÁË¡£·¶ÐÍÊÇÒ»¸öºÜÓÐÓõıà³Ì¹¤¾ß£¬¸øÎÒÃÇ´øÀ´Á˼«´óµÄÁé»îÐÔ¡£ÔÚ¿´ÁË¡¶javaºËÐıà³Ì¡·Ö®ºó£¬ÎÒСÓÐÊÕ»ñ£¬Ð´³öÀ´Óë´ó¼Ò·ÖÏí¡£
Ëùν·¶ÐÍ£¬Îҵĸоõ¾ÍÊÇ£¬²»Óÿ¼ÂǶÔÏóµÄ¾ßÌåÀàÐÍ£¬¾Í¿ÉÒÔ¶Ô¶ÔÏó½øÐÐÒ»¶¨µÄ²Ù×÷£¬¶ÔÈκζÔÏó¶¼ÄܽøÐÐͬÑùµÄ²Ù×÷¡£Õ ......