cancel
Showing results for 
Search instead for 
Did you mean: 

Doubts on casting concepts in TAW12 part 1

Former Member
0 Kudos

Can someone help me clarify a little confusion on Casting in materials provided by SAP Education on TAW12 part 1.

I attended ILT and my instructor emphasized that: "wherever in this material we read 'Up-cast' or 'Down-cast', we should consider this as an error because what they meant to say is exactly the opposite".

This has now left me confused especially after revising.

Can someone please share some light on these terminologies and concept? especially in relation to materials provided on TAW12 ABAP Workbench Concept Part 1 (2013 SAP AG. All rights reserved)

I have not been able to find much materials online for this section of the book and for many others.

Any help would be greatly appreciated.

Vince

Accepted Solutions (1)

Accepted Solutions (1)

former_member187692
Participant
0 Kudos

Hi Vince,

               First thing, STOP worrying about the SAP material whether the contain is right/wrong.

     

              Now, what I understand is that the instructor tried to explain the concepts in a easy way to remember but has that seems to have messed up your basics on up-cast & down-cast.

I have looked in my sap material ( but its 2005 SAP AG reserved ).  The definition are fine.

Anyways I'll try to explain in my style:

Narrow casting( up-casting ):- Assigning of a subclass instance to a reference variable of type " reference to super class ". Here we navigate from a more detailed view to one with less details.

Widening Cast( down-cast ):-  Assigning a super class to a sub class. From a less detailed view to more detailed view.

                         SUPER CLASS( vehicle ) less details

                                   |

                                   |

                                   |

                            SUB CLASS ( car, truck, bus, bike ) more details

PS:- Try to understand the meaning from the example and then go back to the definition in the material.

Former Member
0 Kudos

Thanks Krishna,

That re-affirms what I am reading instead of trying to read one thing, understand it well and consider it wrong.

your explanation is much clear ans straight to the point.

Thanks.

Answers (0)