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
when run my program in se38 it was showing output, when i take background execution and giving printer details it was shoing out put. but in SP01 when i give the Spool Request Number it was showing not yet processed entire page why it happens i dont know please give me a solution.
Can you create an internal table dynamically?(at run time)
Explain the properties of selection screen?
How do you validate the selection criteria of a report? And how do you display initialvalues in a selection screen?
Explain the advantages and disadvantages of abap query tool?
How many types of buffering? : abap data dictionary
Explain what is an rdbms?
What are the differences between the table and the structure in the data dictionary in the sap abap?
SM35 transaction, How to automate BDC ?
Explain the difference between a pool table and a transparent table?
What are the basic functions of database utility? : abap data dictionary
What are the components of selection table?
How is conversion of data types done between abap/4 & db layer?
Which one is better joins or views and why?
What is static attribute