Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
41
Task/Break-OO-privacy/ABAP/break-oo-privacy.abap
Normal file
41
Task/Break-OO-privacy/ABAP/break-oo-privacy.abap
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
class friendly_class definition deferred.
|
||||
|
||||
class my_class definition friends friendly_class .
|
||||
|
||||
public section.
|
||||
methods constructor.
|
||||
|
||||
private section.
|
||||
data secret type char30.
|
||||
|
||||
endclass.
|
||||
|
||||
class my_class implementation .
|
||||
|
||||
method constructor.
|
||||
secret = 'a password'. " Instantiate secret.
|
||||
endmethod.
|
||||
|
||||
endclass.
|
||||
|
||||
class friendly_class definition create public .
|
||||
|
||||
public section.
|
||||
methods return_secret
|
||||
returning value(r_secret) type char30.
|
||||
|
||||
endclass.
|
||||
|
||||
class friendly_class implementation.
|
||||
|
||||
method return_secret.
|
||||
|
||||
data lr_my_class type ref to my_class.
|
||||
|
||||
create object lr_my_class. " Instantiate my_class
|
||||
|
||||
write lr_my_class->secret. " Here's the privacy violation.
|
||||
|
||||
endmethod.
|
||||
|
||||
endclass.
|
||||
Loading…
Add table
Add a link
Reference in a new issue