• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dynamic cast problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic cast problem


  • Subject: Re: dynamic cast problem
  • From: mark <email@hidden>
  • Date: Fri, 25 May 2007 16:55:04 +1200

Title: Re: dynamic cast problem
class SORef {...};
class SelectedFORef : public SORef {...};
SelectedFORef SOCastToSOF(SORef sor) {
   SelectedFORef sof=nil;
   sof=dynamic_cast<SelectedFORef>(sor);
   return sof;
   };


I'm an idiot.
Above should be

class SOObject {...};
typedef class SOObject * SORef;

class SelectedFileObject : public SOObject {...};
typedef class SelectedFileObject * SelectedFORef;

SelectedFORef SOCastToSOF(SORef sor) {
        SelectedFORef sof=nil;
        sof=dynamic_cast<SelectedFORef>(sor);
        return sof;
   };


I am getting a problem where sor is not being cast to sof (stays nil) even though sor IS a SelectedFORef underneath. (I have a debug method with details contents and type).

I am not a C++ expert, but I can't see why this won't cast.
What am I doing wrong?

Mark
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: dynamic cast problem
  • Next by Date: Re: dynamic cast problem
  • Previous by thread: Re: dynamic cast problem
  • Next by thread: Re: dynamic cast problem
  • Index(es):
    • Date
    • Thread