Skip to content

Instantly share code, notes, and snippets.

@ortuagustin
Last active December 13, 2016 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ortuagustin/40abdd7a2ce43c47ad0fc94d15ce3fcd to your computer and use it in GitHub Desktop.
Save ortuagustin/40abdd7a2ce43c47ad0fc94d15ce3fcd to your computer and use it in GitHub Desktop.
TSomeClass = class
strict private type
IStrictPrivate = interface
['{4FBB71DA-2E34-470E-8A22-1DB3F7716252}']
end;
strict protected type
IStrictProtected = interface
['{14D38867-7A34-4556-BEBB-CF709FBBA6BC}']
end;
private type
IPrivate = interface
['{6344806C-CA8E-41D7-8982-708555C2057A}']
end;
protected type
IProtected = interface
['{7051E1D4-48D7-4618-B842-B31910DA21AB}']
end;
public
{this compíles} function GetPrivate: IPrivate;
{this compiles} function GetProtected: IProtected;
{this compíles} function _GetPrivate: TSomeClass.IPrivate;
{this compiles} function _GetProtected: TSomeClass.IProtected;
{this compíles} function GetStrictPrivate: IStrictPrivate;
{this compiles} function GetStrictProtected: IStrictProtected;
{ no problem here } function _GetStrictPrivate: TSomeClass.IStrictPrivate;
{ no problem here } function _GetStrictProtected: TSomeClass.IStrictProtected;
end;
// cannot access private symbol TSomeClass.IStrictPrivate
function TSomeClass._GetStrictPrivate: TSomeClass.IStrictPrivate;
begin
end;
// cannot access protected symbol TSomeClass.IStrictProtected
function TSomeClass._GetStrictProtected: TSomeClass.IStrictProtected;
begin
end;
function TSomeClass.GetPrivate: IPrivate;
var
StrictPrivateThing: TSomeClass.IStrictPrivate; { no compiler error here!! }
begin
end;
function TSomeClass.GetProtected: IProtected;
begin
end;
function TSomeClass.GetStrictPrivate: IStrictPrivate;
begin
end;
function TSomeClass.GetStrictProtected: IStrictProtected;
begin
end;
function TSomeClass._GetPrivate: TSomeClass.IPrivate;
begin
end;
function TSomeClass._GetProtected: TSomeClass.IProtected;
begin
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment