zoukankan      html  css  js  c++  java
  • 在delphi中, reintroduce作用

     

    在delphi中, reintroduce作用

    当在子类中重载或者重新声明父类的虚方法时,使用     reintroduce   关键字告知编译器,可以消除警告信息.如:  
       
         TParent   =   class  
             procedure   proc;virtual;  
         end;  
       
         TChild   =   class(TParent)  
             procedure   proc;   reintroduce;   overload;     //重载  
             //procedure   proc;   reintroduce;     //重新声明  
         end;  
     如果此时没有reintroduce关键字,则会出现如下的警告信息:  
       
     [Warning]   Unit1.pas(20):   Method   'proc'   hides   virtual   method   of   base   type  'TParent'  
       
    典型的应用是,你要改变CREATE的参数,那么重新声明的CREATE跟父类的不一样,所以要REINTRODUCE,实际的函数可能是这个样子:  
       
     Constructor   Create(AOwner:   TComponent;   NewParam:   Integer);  
     begin  
         Create(AOwner);  
         ...   //do   something   for   NewParam

  • 相关阅读:
    数组的处理
    bootstrap 列的排序
    bootstrap 偏移
    mysql数据库创建、删除数据库
    Spring 加载配置文件的方式
    MyBatis DAO层传递参数到mapping.xml 几种方式
    Python 正则表达式
    Python 之定时器
    Python学习
    获取鼠标经过位置的X、Y坐标
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/4318480.html
Copyright © 2011-2022 走看看