What is up-casting and down casting? with example
Answer Posted / vamsi krishna srirangam
upcasting is used to acess the common methods of
subclass(which are redefined from super class) using super
class reference.
use:because of this only polymorphism is possible.
example:
lcl_truck,lcl_bus are subclasses to lcl_vehicle
vehicle_list type table of ref to lcl_vehicle.
lcl_vehicle = lcl_truck.
append lcl_vehicle to vehicle_list.
clear lcl_vehicle.
lcl_vehicle = lcl_bus.
append lcl_vehicle to vehicle_list.
clear lcl_vehicle.
now if you redefine the estimate_fuel method in each
subclass then that particular method only called because
fuel estimation is different for bus and truck.
Down-casting:
to take control back to the object that is called now.
to identify the triggered subclass object from the list of
available subclass objects.
?= means check whether the reference(path)
is same. if left hand path is equals to right hand path then
it copies the right hand path to left hand variable.
it is used to pick one from several
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is the difference between semi-monthly and Bi-weekly payroll area
Difference between sap script and report?
Explain the Importance of pa20? : abap hr
What are the different types of the variable in the sap abap?
What is a modification assistant?
Explain different types of attributes of function module?
What are the tcodes for performance tuning?
Does SAP has a GUI screen painter or not? If yes what operating systems is it available on? What is the other type of screen painter called?
Can we control the sequence in which multiple implementations of a multiple use BADI are called? If yes, how?
In BDC, data transfer is done success in foreground mode but if we done the same in background mode it shows errors. What is the reason?
Explain what are standard layouts sets in the sap script?
What is the difference between collect and append statements?
i have executed a report via back ground job, in this report i have used enqueue and dequeue function modules on a table, but before releasing the lock(before dequeue function module is not call) job gives the dump, so the lock is not released the table, here my question is how to set the lock automatically release the there is a short dump before calling the dequeue module?
What is the basic difference internal tables and database tables? : abap data dictionary
What is the name of the system variable that holds the contents of the selected line in interactive reporting?