Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
技术板块灌水区
» 不得不说的delphi技巧
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: 不得不说的delphi技巧
zzzl
(早安的空气)
版主
UID 590
Digest Posts 0
Credits 399
Posts 199
点点分 399
Reading Access 100
Registered 2004-11-29
Status Offline
#1
Post at 2007-1-22 14:00
Profile
|
Blog
|
P.M.
|
不得不说的delphi技巧
熟悉c++的一定知道STL里的pair,正如名字所暗示的一样,它表示一对变量。写程序时经常会碰到一对变量的时候,比如:名和姓,value和key,索引号和其相应的值。所以可以写一个:
pair=record
value1, value2: variant;
procedure assign(v1, v2: variant);//value1:=v1; value2:=v2;
end;
因为函数的返回值只能是一个,所以这个pair在用于返回函数值的时候也是很好用地
jAmEs_
灌水部部长
UID 886
Digest Posts 0
Credits 1134
Posts 600
点点分 1134
Reading Access 10
Registered 2005-6-5
Location 广东
Status Offline
#2
Post at 2007-1-22 16:20
Profile
|
Blog
|
P.M.
不是很明白,可以这样写代码吗?
zzzl
(早安的空气)
版主
UID 590
Digest Posts 0
Credits 399
Posts 199
点点分 399
Reading Access 100
Registered 2004-11-29
Status Offline
#3
Post at 2007-2-1 21:14
Profile
|
Blog
|
P.M.
|
对了,delphi2006以下可能编译不过去
crystal999
新警察
UID 5235
Digest Posts 0
Credits 7
Posts 7
点点分 7
Reading Access 10
Registered 2007-2-1
Status Offline
#4
Post at 2007-2-2 09:17
Profile
|
Blog
|
P.M.
似乎delphi里对RECORD 还不是象类一样对待,不能有函数成员
jAmEs_
灌水部部长
UID 886
Digest Posts 0
Credits 1134
Posts 600
点点分 1134
Reading Access 10
Registered 2005-6-5
Location 广东
Status Offline
#5
Post at 2007-2-2 09:31
Profile
|
Blog
|
P.M.
QUOTE:
原帖由
crystal999
于 2007-2-2 09:17 发表
似乎delphi里对RECORD 还不是象类一样对待,不能有函数成员
94...我以为Delphi可以有这种高级应用的呢。
shenloqi
灌水处处长
UID 34
Digest Posts
1
Credits 287
Posts 179
点点分 287
Reading Access 10
Registered 2003-3-15
Status Offline
#6
Post at 2007-2-2 10:41
Profile
|
P.M.
Delphi后来的版本Record和C++的类似啦,可以有这些东西,D2006也是支持变体的。
jAmEs_
灌水部部长
UID 886
Digest Posts 0
Credits 1134
Posts 600
点点分 1134
Reading Access 10
Registered 2005-6-5
Location 广东
Status Offline
#7
Post at 2007-2-2 10:42
Profile
|
Blog
|
P.M.
后来的版本是指哪个?
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#8
Post at 2007-2-2 11:09
Profile
|
Blog
|
P.M.
D8以后吧,2005,2006为代表。
kendling
(小冬)
高级版主
MyvNet
UID 703
Digest Posts
5
Credits 978
Posts 580
点点分 978
Reading Access 101
Registered 2005-2-18
Location 广东
Status Offline
#9
Post at 2007-2-6 00:47
Profile
|
Site
|
Blog
|
P.M.
|
|
这个还真不知道。
小冬
http://MyvNet.com
bahamut8348
灌水司司长
UID 4743
Digest Posts
14
Credits 337
Posts 79
点点分 337
Reading Access 10
Registered 2007-1-18
Status Offline
#10
Post at 2007-2-6 09:38
Profile
|
Blog
|
P.M.
DELPHI里还有一个OBJECT类型的,可以看成是一个RECORD类型,
因为他不需要CRATE的
而且也支持函数和方法……
做人要厚道,看帖要回贴
kendling
(小冬)
高级版主
MyvNet
UID 703
Digest Posts
5
Credits 978
Posts 580
点点分 978
Reading Access 101
Registered 2005-2-18
Location 广东
Status Offline
#11
Post at 2007-2-6 09:54
Profile
|
Site
|
Blog
|
P.M.
|
|
可否给个例子?
小冬
http://MyvNet.com
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 07:17
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.009172 second(s), 7 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats