Answer Posted / rs agarwal
1. Narrow casting
2. Wide casting
Demo on "Narrow Casting" Parent class->M1 , Child class-
>M1,M2
Attributes of super class can only be accessed.
Methods defined at Super class(M1) can only be accessed.
Methods with REDEFINED Logic(M1) will be called
Methods in child class (M2) cannot be accessed
Demo on "Wide Casting" Parent class->M1 , Child class->M1,M2
Assign address of PARENT to CHILD Class object
Methods defined at child class(M2) can also be accessed
with Parent reference.
Methods with REDEFINED Logic (M1) will be called
The cast is only possible if the object was instantiated as
the child and then it was casted to the parent object and
then back again to the child object. The child has
everything the parent has so there is no problem with this
path.
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Lock objects and what are parameters of ENQUEUE FM?
what are the 2 other types of views, which are not allowed in release 3.0? : abap data dictionary
What are the different types of mode (run code) in call transaction method?
Under Data Transfer Portion of ABAP, what do you mean by DX Project
What are the aggregate objects in the dictionary? : abap data dictionary
How do you control printer functions from sapscript?
What are system variable in abap?
How can we decide weather we can enhance the standard infotype or not ? : abap hr
What is sequence of event triggered in report?
Explain the types of bdc's?
Polymorphism real time scenario
What is an rfc?
Where do you find info on new developments in SAP?
How to handle error in session method? : abap bdc
Do we have to migrate all sapscript forms to smart forms?