Vote UpVote

delphi: you can only access protected identifiers from parent classes in your own “Self” scope, or when you are “friends” with your parent (so you are in the same unit)

The Wiert Corner – An interesting question from a while back: [WayBack] delphi – Should a descendant class’ method’s variable that is identical to Self, have access to its ancestor’s protected methods? – Stack Overflow In unit A: TParent = class protected function DoSomething: TParent; end; In unit B: TChild = class(TParent) public procedure DoAnotherThing; end; implementation procedure TChild.DoAnotherThing; begin DoSomething.DoSomething end; … This won’t compile, throwing a cannot access protected symbol TParent.DoSomething The kicker here is that the error ...
Favorite? Off-Topic? jpluimers @ 2019-09-11 19:05


Visits: 57
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Michał Rajewicz
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)