04-01-2008 9:39 AM
Hi,
Is it right, that at Release 6.40
Up Cast = Narrowing Cast
Down Cast = Widening Cast
and at Release 7.0
Up Cast = Widening Cast
Down Cast = Narrowing Cast
???
04-01-2008 10:23 AM
No. Why do you suspect that it has?
Up Cast = Widening Cast
Down Cast = Narrowing Cast
matt
04-01-2008 10:29 AM
OK, Thanks.
Then is my education material (Release 6.40) wrong!
in my material stands, that
Up Cast = Narrowing Cast
Down Cast = Widening Cast
thats why I'm asking.
Sören
04-01-2008 11:13 AM
It seems that it is wrong. Up cast means going up the inheritance tree - i.e. subclass to superclass (or interface). And this is wider, since the superclass is more general.
04-02-2008 7:12 AM
hi
ur 6.4 material is correct.....
NARROWING CAST --- UP-CAST....
The assignment of a subclass instance to a reference variable of the type reference to superclass is described as a narrowing cast, because you are switching from a view with more detail to a view with less detail(Generalization)
It also called as up-cast bcoz the casting is done in up.......
WIDENING CAST -
DOWN-CAST.....
Hear the view changes to more detail view (Specialization)..
reward if it useful
05-19-2009 6:28 AM
I have only just started reading about Casting.
I have ABAP Object 2007 book from Horst Keller and I also have a 7.0 SAP System.
SAP have certainly changed the terminology from SAP 6.40.
Please see this hyperlink [Version 7.0 ABAP Modification 6|http://help.sap.com/abapdocu/en/ABENNEWS-70-DOCU.htm#!ABAP_MODIFICATION_6@6@]
In addition when I click on Help on MOVE and the Casting operator in my 7.0 Version system is explained as
Up Cast
Also referred to as widening cast. Assignment between reference variables, where the static type of the target variables is similar or identical to the static type of the source variables.
Down cast
Also called a narrowing cast, a down cast is an assignment between reference variables in which the typr static type of the target variable more specific than the static type of the source variable. A down cast is only possible in assignments with the casting operator (?=) or MOVE ... ?TO. Compare with up cast
SAP now want you to use the unambiguous terms of UP and DOWN Version 7.0 of course.
Does anybody else have any comments on this ?
10-11-2011 4:06 AM
Does anyone has a final answer about this thread?
I have the Keller's book and metioned Widening = down cast and Narrowing like up cast, obviosly this will depends of the focus that you adopt, but I have the last certification books and metioned in the other sense, please if you have the final SAP answer or explanation about this change, let me know.
Thanks.
10-11-2011 7:45 AM
Hello,
Peter is right. The terminology has changed. Up cast is now refered as widening cast . Down cast as narrowing cast . This changed arises from different look at the matter.
Normaly we got used to say windening cast refers to target class that has greater scope (is subclass) than source class (superclass). Subclass usually has more methods than its parent class.
Now we use to say widening cast refers to target class that has more general meaning (superclass) than source class (subclass). So we switch from more specialized view to more general one. That's why we say widening cast.
Regards
Marcin