casting class pointer

Jesse Phillips jessekphillips+D at gmail.com
Thu Nov 18 15:53:49 PST 2010


Jonathan M Davis Wrote:

> Just dereference the pointer. I believe that in effect you have a pointer to a 
> reference, not a pointer to an Object. Regardless of what it does internally 
> though, the way to get at the object is to dereference it. If you had

The question wasn't exactly about how to get a reference to the class. The code has been evolving over time, and the cast was originally there to convert a reference of type A to type B. As I've been changing it things have become pointers and most importantly their actual type. (I've actually removed most pointers now).

I just thought having cast basically do a deference/conversion wouldn't be a bad thing when casting to a class. I realize cast is supposed to be a fast operation, but if it could do the right thing too, that would be nice. Since it is there to break the type system I can't exactly ask for it to throw an Error.


More information about the Digitalmars-d mailing list