if A goes out of scope does this mean the pointer B is a bad pointer meaning it does not point to anywhere?
Yes, A goes out of scope and its destructor is called. You should really
have B in the same scope as A. That means B shouldn't be global.
If so, does this mean I still need to have somewhere in my program an instance of class derived?
care to elaborate?