CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2007
    Posts
    143

    Wink Reason for upcast and downcast

    Helo guys,
    can anyone clarify me like what is the need for doing downcast and upcast ?

    Thanks in advance

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Reason for upcast and downcast

    You should never need to explicitly upcast. The assignment should just work. (Be careful of slicing, though.)

    Normally you should avoid downcasting, but on some occasions it's useful if you know the specific type of a particular object through other means and you need to access functionality particular to that type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured