What counts as a "valid complete object"?

Hey everyone!

I was making my way through the documentation of the c++ language on this website and I was reading about type-casting, they were using the term "valid complete object" quite a bit, but I don't know what it means, so I was hoping you could tell me what exactly counts as a "valid complete object"

thanks.
Last edited on
A quick google later, I see this phrae is turning up in discussions about dynamic_cast.
e.g, from: C++ Type Casting
http://vernavi.com/tech/?page_id=156

dynamic_cast

Its purpose is to ensure that the result of the type conversion is a valid complete object of the requested class.

In this context, it saying that the result of a dynamic_cast (when used correctly, from a polymorphic base class to one of its derived classes) is guaranteed to be a complete and valid class.

If you misused static_cast, which doesn't make this guarantee, and the base class pointer/reference was referring to a class other than the one you cast the pointer/reference to, then the pointer/reference will end up referring to an object which very probably has the wrong size and layout.

Not sure I've been esp. clear, but that's the gist of it.

Andy
Last edited on
Topic archived. No new replies allowed.