Skip to Content
author's profile photo Former Member
Former Member

Change Narrowing and Widening Cast

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

???

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Apr 01, 2008 at 09:23 AM

    No. Why do you suspect that it has?

    Up Cast = Widening Cast

    Down Cast = Narrowing Cast

    matt

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2008 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.