Delphi通过inherited 可以调用父类的方法,但是没有提供直接调用父类的父类的方法(爷爷类),通过变通的方式实现如下: 假设父类是TFather,爷爷类TGrand,调用爷爷类的Write方法: 1 2 3 4 5 6 7 8 9 type TWriteProc=procedure of     Read More
posted @ 2019-09-24 17:00
findumars
Views(322)
Comments(0)
Diggs(0)
        
            
        
        
        
本文来自:http://www.cnblogs.com/hezihang/p/6083555.html Delphi采用接口方式设计模块,可以降低模块之间的耦合,便于扩展和维护。本文提供一个实现基于接口(IInterface)方式的监听器模式(观察者模式、订阅者模式),实现一个自动多播器。 下面程序    Read More
posted @ 2019-09-24 16:52
findumars
Views(488)
Comments(0)
Diggs(0)
        
            
        
        
        
通过TObject.GetInterface可以获得对象的实例实现某个接口,前提条件是必须实例化对象后才能运行GetInterface 下面的方法可获取类是否实现了某个接口,并返回接口的偏移: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21    Read More
posted @ 2019-09-24 16:51
findumars
Views(483)
Comments(0)
Diggs(0)
        
            
        
        
        
以往的Delphi版本,不支持接口的Weak,和UnSafe的引用,支持对象的Weak, UnSafe,而且仅在Android和Ios平台上支持。 现在Delphi XE10.1 Berlin终于增加了对接口的Weak, UnSafe的支持。 1.Weak Weak引用,不影响引用计数器,但是如果对    Read More
posted @ 2019-09-24 16:48
findumars
Views(552)
Comments(0)
Diggs(0)
        
 
                    
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号