Delphi use reflection in a class procedure for the getting dynamic class type


I want use reflection on the current class inside a class procedure/function (static method). How can I do without using the "Self" keyword? And without harcode the class name: this procedure should be override in the descendants.

class procedure AAA.SetTableAndSequence; var c : TRttiContext; t : TRttiType; begin c := TRttiContext.Create; try t := c.GetType(Self.ClassType); ... finally c.Free; end; end;


You can use <a href="http://docwiki.embarcadero.com/Libraries/XE6/en/System.TObject.ClassInfo" rel="nofollow">ClassInfo</a> and <a href="http://docwiki.embarcadero.com/Libraries/XE6/en/System.Rtti.TRttiContext.GetType" rel="nofollow">GetType</a>:

class procedure AAA.SetTableAndSequence; var c: TRttiContext; t: TRttiType; begin t := c.GetType(ClassInfo); ... end;


  • Can't edit my datagridview after binding to XML file via linq
  • Export excel file to txt format via excel vba GUI
  • What is a good way to read this XML?
  • how to extract text from a html element by id and assign to a php variable?
  • XML delete node according to timestamp C#
  • MVC - Dynamically loading Partial Views
  • Decoding PubNub messages with golang JSON
  • How to access UIViewController's varaibles inside “func applicationWillResignActive”? Swift, iO
  • How to develop MS CRM kind of application
  • Auto Height of UICollectionView inside UITableViewCell
  • Convert Func to Func
  • Any command in mysql equivalent to Oracle's autotrace for performance turning
  • JPA CDI Injecting DAO into an Entity
  • Custom Nav Title offset ios 11
  • Vigenere cipher not working
  • Swift Initialization Rule Confusion
  • Translating C# to PowerShell in InterIMAP
  • Detecting null parameter in preprocessor macro
  • Functions in global context
  • Update CALayer sublayers immediately
  • JFileChooser in front of fullscreen Swing application
  • sending/ receiving email in Java
  • Trying to switch camera back to front but getting exception
  • Cannot Parse HTML Data Using Android / JSOUP
  • PHP: When would you need the self:: keyword?
  • How to delete a row from a dynamic generate table using jquery?
  • Proper way to use connect-multiparty with express.js?
  • Acquiring multiple attributes from .xml file in c#
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • unknown Exception android
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Checking variable from a different class in C#
  • Programmatically clearing map cache
  • reshape alternating columns in less time and using less memory
  • Observable and ngFor in Angular 2
  • failed to connect to specific WiFi in android programmatically
  • Unable to use reactive element in my shiny app
  • How can I use threading to 'tick' a timer to be accessed by other threads?