| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> Delphi xue xi :OOP zhong de shuang ren jian

Delphi xue xi :OOP zhong de shuang ren jian

2006-12-16 17:27:43 编辑來源:互联网 评论
 
 
 
本文为【Delphi学习:OOP 中的双刃剑】的拼音翻译版
  qian ji tian kan yi fen fei chang you ming de shang ye kong jian de yuan ma , fa xian yi ge fei chang you qu de yong fa :
  Integer(xxx) := aaa;
  
  Tttt(xxx) := bbb;
  xi xi pin wei , fa xian li yong zhe zhong yong fa wang wang ke yi shou dao yi xiang bu dao de xiao guo :
  bi ru :
  
  
  
  TTestRec = record
   A, B, C: Integer;
  end;
  TTestCls = class
  private
   FInner: TTestRec;
   FReadOnlyValue: Integer;
   function GetNewInner: PTestRec;
  public
   property Inner: TTestRec read FInner write FInner;
   property NewInner: PTestRec read GetNewInner;
   property ReadOnlyValue: Integer read FReadOnlyValue;
  end;
  ni hui fa xian , zhi jie de ni shi gai bu le aTestCls.Inner.A de ( bian yi shi delphi zhi jie bao cuo , yin wei delphi 7 zhong liang ge recode fu zhi shi copy memory er bu shi jian dan de “ chuan zhi ”!
  
  
  
  procedure TForm1.Button1Click(Sender: TObject);
  begin
  with TTestCls.Create do
  try
  // Inner.A := 10;
   Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A);
  finally
   Free;
  end;
  end;
  ke shi , ru guo wo men zhi dao zai fang wen zhe ge Inner shi delphi zai bian yi zhi jie FInner de di zhi , na me , jie he shang mian na zhong you qu de yong fa :
  
  
  
  procedure TForm1.Button3Click(Sender: TObject);
  var
  p: PInteger;
  begin
  with TTestCls.Create do
  try
   p := @(Inner.A);
   Integer(p^) := 100;
   Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A);
  finally
   Free;
  end;
  end;
  geng jin yi bu , li yong zhi zhen jing ran ke yi tu po oo dui private de bao hu :
  
  
  
  procedure TForm1.Button4Click(Sender: TObject);
  var
  p: PInteger;
  begin
  with TTestCls.Create do
  try
   p := @(ReadOnlyValue);
   Integer(p^) := 1000;
   Caption := TButton(Sender).Caption + ' ReadOnlyValue := ' + IntToStr(ReadOnlyValue);
  
  ||||||
  
  
  finally
   Free;
  end;
  end;
  
  zhi yu “ cai guo jie ” na geng bu zai hua xia :
  
  
  
  procedure TForm1.Button5Click(Sender: TObject);
  var
  p1, p2: PInteger;
  begin
  with TTestCls.Create do
  try
   p1 := @(Inner.A);
   // nei cun zhong FInner yu FReadOnlyValue qi shi zhi cha TTestRec da xiao ge zi jie
   Integer(p2) := Integer(p1) + SizeOf(TTestRec);
   Integer(p2^) := 100;
   Caption := TButton(Sender).Caption + ' ReadOnlyValue := ' + IntToStr(ReadOnlyValue);
  finally
   Free;
  end;
  end;
  dang ran , zhi zhen bu dan ke yi po huai oo, ye neng shi nin de dai ma geng jia de oo:
  
  
  
  TTestRec = record
   A, B, C: Integer;
  end;
  PTestRec = ^TTestRec;
  TTestCls = class
  private
   FInner: TTestRec;
   FReadOnlyValue: Integer;
   function GetNewInner: PTestRec;
  public
   property Inner: TTestRec read FInner write FInner;
   property NewInner: PTestRec read GetNewInner;
   property ReadOnlyValue: Integer read FReadOnlyValue;
  end;
  procedure TForm1.Button2Click(Sender: TObject);
  begin
  with TTestCls.Create do
  try
   NewInner.A := 10;
   Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A);
  finally
   Free;
  end;
  end;
  kan kan xian shi zhong de fei oo de dai ma :
  
  li yong “ zhi zhen fang an ” ba Txxx gai cheng Pxxx hou jing ran dui yuan lai de dai ma yi dian ying xiang dou mei you , er shi zhi geng jia de oo【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
  qian ji tian kan yi fen fei chang you ming de shang ye kong jian de yuan ma , fa xian yi ge fei chang you qu de yong fa :   Integer(xxx) := aaa;   Tttt(xxx) := bbb;    xi xi pin wei , fa xian li yong zhe zhong yong fa wang wang ke yi shou dao yi xiang bu dao de xiao guo :    bi ru : TTestRec = record A, B, C: Integer; end; TTestCls = class private FInner: TTestRec; FReadOnlyValue: Integer; function GetNewInner: PTestRec; public property Inner: TTestRec read FInner write FInner; property NewInner: PTestRec read GetNewInner; property ReadOnlyValue: Integer read FReadOnlyValue; end;    ni hui fa xian , zhi jie de ni shi gai bu le aTestCls.Inner.A de ( bian yi shi delphi zhi jie bao cuo , yin wei delphi 7 zhong liang ge recode fu zhi shi copy memory er bu shi jian dan de “ chuan zhi ”! procedure TForm1.Button1Click(Sender: TObject); begin with TTestCls.Create do try // Inner.A := 10; Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A); finally Free; end; end;    ke shi , ru guo wo men zhi dao zai fang wen zhe ge Inner shi delphi zai bian yi zhi jie FInner de di zhi , na me , jie he shang mian na zhong you qu de yong fa : procedure TForm1.Button3Click(Sender: TObject); var p: PInteger; begin with TTestCls.Create do try p := @(Inner.A); Integer(p^) := 100; Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A); finally Free; end; end;    geng jin yi bu , li yong zhi zhen jing ran ke yi tu po oo dui private de bao hu : procedure TForm1.Button4Click(Sender: TObject); var p: PInteger; begin with TTestCls.Create do try p := @(ReadOnlyValue); Integer(p^) := 1000; Caption := TButton(Sender).Caption + ' ReadOnlyValue := ' + IntToStr(ReadOnlyValue); |||||| finally Free; end; end;    zhi yu “ cai guo jie ” na geng bu zai hua xia : procedure TForm1.Button5Click(Sender: TObject); var p1, p2: PInteger; begin with TTestCls.Create do try p1 := @(Inner.A); // nei cun zhong FInner yu FReadOnlyValue qi shi zhi cha TTestRec da xiao ge zi jie Integer(p2) := Integer(p1) + SizeOf(TTestRec); Integer(p2^) := 100; Caption := TButton(Sender).Caption + ' ReadOnlyValue := ' + IntToStr(ReadOnlyValue); finally Free; end; end;    dang ran , zhi zhen bu dan ke yi po huai oo, ye neng shi nin de dai ma geng jia de oo: TTestRec = record A, B, C: Integer; end; PTestRec = ^TTestRec; TTestCls = class private FInner: TTestRec; FReadOnlyValue: Integer; function GetNewInner: PTestRec; public property Inner: TTestRec read FInner write FInner; property NewInner: PTestRec read GetNewInner; property ReadOnlyValue: Integer read FReadOnlyValue; end; procedure TForm1.Button2Click(Sender: TObject); begin with TTestCls.Create do try NewInner.A := 10; Caption := TButton(Sender).Caption + ' A := ' + IntToStr(Inner.A); finally Free; end; end;    kan kan xian shi zhong de fei oo de dai ma :    li yong “ zhi zhen fang an ” ba Txxx gai cheng Pxxx hou jing ran dui yuan lai de dai ma yi dian ying xiang dou mei you , er shi zhi geng jia de oo
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
时尚秀气模特裴裴(8)
时尚秀气模特裴裴(7)
时尚秀气模特裴裴(6)
时尚秀气模特裴裴(5)
白墙黑瓦
广州东郊[原创]
八美至丹巴的东谷天然盆景
不一样的
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有