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

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.


Ïà¹ØÎĵµ£º

JavaµÄmain·½·¨ÓëÀàµÄ¼ÓÔصÄÁªÏµ

¼øÓÚÐí¶àͬѧ¶ÔÕâ¸ömain·½·¨µÄÃÔ»ó£¡ÎÒÕâÀïÌṩһЩÒâ¼û£¬Ï£Íû¶Ô´ó¼ÒÓаïÖú£¡ºÇºÇ£¡
     ****ÎÒÃÇ˵¼ÓÔØÏÈ£º
      JavaµÄÀàÊÇÓõ½²Å¿ªÊ¼¼ÓÔصģ¬²¢ÇÒÔÚÿ¸öÀàµÄ¹¹ÔìÆ÷µ÷ÓÃ֮ǰ£¬ÀàµÄÿ¸öÓò£¨³ÉÔ±±äÁ¿£©¶¼ÒªÊ×Ïȱ»±àÒëÆ÷³õʼ»¯Ò»´Î£¬È»ºó²ÅÂÖµ½¹¹ÔìÆ÷À´¸É»î¶ù¡£µ«ÊÇ£¬Java ......

java³ÌÐò~ÌìÊý


//ÊäÈëijÄêijÔÂijÌ죬Êä³öÕâÒ»ÌìÊÇÕâÒ»ÄêµÄµÚ¼¸Ìì
public class DaySum {
 public static void main(String[] args)
 {
  date da=new date();
  System.out.println(da.count(2008,12,31));
 }
 
}
class date
{
 int count(int  year,int month,int day) ......

dzÎöJava web³ÌÐòÖ®¿Í»§¶ËºÍ·þÎñÆ÷¶Ë½»»¥Ô­Àí

dzÎöJava web³ÌÐòÖ®¿Í»§¶ËºÍ·þÎñÆ÷¶Ë½»»¥Ô­Àí
½üÀ´Ò»Ö±ÔÚ˼¿¼Ò»¸öÒÉÎÊ£¬ÎªÊ²Ã´ÔÚÓÃstruts¿ò¼Ü¿ª·¢µÄʱºòFormBean¶¼ÐëÒªÐòÁл¯£¬¼´ÊµÏÖJava.io.Serializable½Ó¿Ú£¬±¾×ÅÇÚѧºÃÎʵľ«ÉñÎÒGoogleÁË϶ÔÏóÐòÁл¯·½ÃæµÄÎÄÕ£¬ËäÈ»´óÌåÃ÷°×ÁËÈçºÎ×ö£¬µ«ÊÇ»¹ÊÇûÓиãÇå³þΪʲôҪÕâÑù×ö£»½áβÎÒÏë´¦ÀíÒ»¸öÒÉÎÊÒªÕÒÒÉÎʵĸùÔ´ºÍ±¾ÖÊ ......

ÉîÈëdz³öJavaÉè¼Æģʽ֮ÊÊÅäÆ÷ģʽ


ͨ³££¬¿Í»§Àà(clients of class)ͨ¹ýÀàµÄ½Ó¿Ú·ÃÎÊËüÌṩµÄ·þÎñ¡£ÓÐʱ£¬ÏÖÓеÄÀà(existing class)¿ÉÒÔÌṩ¿Í»§ÀàµÄ¹¦ÄÜÐèÒª£¬µ«ÊÇËüËùÌṩµÄ½Ó¿Ú²»Ò»¶¨ÊÇ¿Í»§ÀàËùÆÚÍûµÄ¡£ÕâÊÇÓÉÓÚÏÖÓеĽӿÚÌ«Ïêϸ»òÕßȱ·¦Ïêϸ»ò½Ó¿ÚµÄÃû³ÆÓë¿Í»§ÀàËù²éÕҵIJ»Í¬µÈÖî¶à²»Í¬Ô­Òòµ¼Öµġ£
¡¡¡¡ÔÚÕâÖÖÇé¿öÏ£¬ÏÖÓеĽӿÚÐèҪת»¯(convert)Ϊ¿ ......

Java Éè¼Æ¼Ü¹¹


Ŀ¼
ÕªÒª ……………………………………………………………………2
ÎÄÏ××ÛÊö ……………………&h ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ