码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi调用爷爷类的方法

时间:2014-12-03 13:48:04      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:blog   ar   div   log   as   tt   type   方法   br   

Delphi通过inherited 可以调用父类的方法,但是没有提供直接调用父类的父类的方法(爷爷类),通过变通的方式实现如下:

假设父类是TFar,爷爷类TGrand,调用爷爷类的Write方法:

type
  TWriteProc=procedure of Object;
var
  WriteProc:TWriteProc;

....
  TMethod(WriteProc).Code:=@TGrand.Write;
  TMethod(WriteProc).Data:=Self;
  WriteProc;

  

Delphi调用爷爷类的方法

标签:blog   ar   div   log   as   tt   type   方法   br   

原文地址:http://www.cnblogs.com/hezihang/p/4139656.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!