Hi, I am pulling my hair out(& soon will be bald)
I have a very strange situation. I have a derived c++ class, where in
base class there is a pure virtual method declared as
void dosomething() const;
within my implementation of dosomething() I attempting to copy the this
pointer like:
void dosomething()
{
MyDerivedType *p = (MyDerivedType *)this;
assert(p);
}
it seems that under some rare circumstances this cast returns a 0x0?? It
has happened twice now in the past couple of weeks. I need the cast
because of the const that was declared in the base class on the pure
virtual method dosomething(). My question is why is this cast returning
0x0?? Aren't the old style pointer casts supposed to always work?? I
could see getting a 0x0 out of this if I was using const cast or dynamic
cast. what gives? Why isn't doesn't this cast evaluate as a a simple
pointer copy?
--
Burlen Loring
Information Technologist III
Space Science Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
39 College Road, Durham, NH 03824
Phone: 603-862-1140