Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CASTING IN ABAP

waqasalikhan
Discoverer
0 Kudos
446

hello ,

my question is about narrow and wide casting.

when i read from text books of sap its appear to be in opposite definition according to in scn search (experts opinion )?

thank-you
regards

student.

1 ACCEPTED SOLUTION

retired_member
Product and Topic Expert
Product and Topic Expert
0 Kudos
373

To be honest, in some early stage of ABAP Objects we said in fact

"Narrowing Cast" for "Up Cast" and "Widening Cast" for "Down Cast".

Since Release 7.0, we do it as the rest of the world and say

"Narrowing Cast" for "Down Cast" and "Widening Cast" for "Up Cast".

This is even documented!

Terminology change for narrowing and widening casts

So you might have read old SAP textbooks

5 REPLIES 5

former_member202771
Contributor
0 Kudos
373

Hi Waqas,

When you loose attributes during assignment, it is narrow casting. And When you gain new attributes, it is widening.

Does text books say it differently ?

Thanks,

Anil

Sandra_Rossi
Active Contributor
0 Kudos
373

No, it's exactly the same definition for ABAP and for "all" other OO languages (I don't know all of course)

0 Kudos
373

thank-you  

retired_member
Product and Topic Expert
Product and Topic Expert
0 Kudos
374

To be honest, in some early stage of ABAP Objects we said in fact

"Narrowing Cast" for "Up Cast" and "Widening Cast" for "Down Cast".

Since Release 7.0, we do it as the rest of the world and say

"Narrowing Cast" for "Down Cast" and "Widening Cast" for "Up Cast".

This is even documented!

Terminology change for narrowing and widening casts

So you might have read old SAP textbooks

0 Kudos
373

great thank u ..