Mega Code Archive

 
Categories / Delphi / Examples
 

Protected properties

How to access properties and methods in the PROTECTED section of a class. This one really is simple. It is also very well known, but I'll include it here just for all those people who don't know how to do it. For example, if you needed to access the canvas property of a DBGrid, you would do the following : type THackDBGrid = Class(DBGrid); Then, whenever you need to access the Canvas property of your DBGrid you would typecast it as a THackDBGrid, like so : with THackDBGrid(DBGrid1).Canvas do