Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is main window mandatory in smartforms?

1232


What is meant by authorization? Did you ever work on it? : sap abap hr

989


Explain how to create any functions?

1204


What is size category?

1060


How we format the data before writing a statement in the report?

950


Can a transparent table exist in data dictionary but not in the database physically? : abap data dictionary

1179


Explain what is the step-by-step process to create a table in data dictionary?

1184


Which objects are independent transport objects?

1336


What are lock objects?

1074


What is the disadvantage of a call by reference?

1163


What are the advantages and disadvantages of different types of bdc's?

1159


Define database layer?

1098


How many main windows will be there in a page window?

1018


What are the uses of the information in the data dictionary? : abap data dictionary

1260


What are user exits? What is involved in writing them? What precations are needed?

1109