vlad-ardelean
vlad-ardelean

Reputation: 7622

Is it possible to violate Encapsulation by Reflection in ABAP?

Is it possible to:

..from a context where these are not in scope?

Not planning to do any architecture like this, i just want to know if it's possible.

Upvotes: 2

Views: 197

Answers (2)

vwegert
vwegert

Reputation: 18483

Since the debugger is written in ABAP and the debugger can display the contents of private members, the former is possible (if not easy - you have to do some really risky low-level stuff I'd not recommend for obvious reasons). For calling private methods, I'm not sure but I'd doubt that it's possible.

Upvotes: 1

Udo Klein
Udo Klein

Reputation: 6882

ABAP is an interpreted language. So the interpreter is aware of anything anytime. Even with reflection (RTTI/RTTC) and/or dynamic calls you can not access private members out of scope.

However if you have declared friends, then the friends can access private members of course.

Upvotes: 2

Related Questions