Limiting method access in protected section to few classes

Posted by Bharat on Stack Overflow See other posts from Stack Overflow or by Bharat
Published on 2010-06-07T15:35:04Z Indexed on 2010/06/07 16:12 UTC
Read the original article Hit count: 273

Filed under:
|

Hi,

I want to limit the access of protected methods to certain inherited classes only.

For example there is a base class like

TBase = Class
  Protected
    Method1;
    Method2;
    Method3;
    Method4;
End;

I have two classes derived from TBase

TDerived1 = Class(TBase)
  //Here i must access only Method1 and Method2
End;

TDerived2 = Class(TBase)
  //Here i must access only Method3 and Method4
End;

Then is it possible to access only Method1 and Method2 when i use objects of TDerived1 and Method3 and Method4 when i use objects of TDerived2

© Stack Overflow or respective owner

Related posts about delphi

Related posts about oop