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

what is the exact code that shoud be implimented in sap note

2452


What are the differences between transparent tables, pooled tables & cluster tables? : abap data dictionary

1161


Name a few data dictionary objects? : abap data dictionary

1075


What is the different between abap and ooabap? Why do we use ooabap?

1150


Can we handle two transaction codes in the same program using call transaction bdc input method? : abap bdc

1177


Reports: Event functionality.

1301


What is the bapi?

1095


How can we declare a table control in the abap/4 program?

1125


What is the function of the correction system? : abap data dictionary

1029


How to transfer data into line items using batch input session method? : abap bdc

1052


What kind of deliverables you have on a day to day basis?

1374


MY DOMAIN IS SAP-ABAP COMPARE TO WEBDYNPRO AND CRM-TECHNICAL WHICH IS BEST?

2895


Difference between sy-tabix and sy-index?

1293


How do you set up background jobs in sap? What are the steps? What are the events driven batch jobs?

960


What is a function group? : abap modularization

1025