I'm trying to create a new type vector containing elements from a base class. What I did is a dynamic\_cast of the base class vector elements to the derived type in order to apply some methods I added in the derived class. 

This is what I approximately did:

```
std::vector<BaseClass *> A;
std::vector<DerivedClass *> B;
DerivedClass *m = new DerivedClass;
std::vector<BaseClass *>::const_iterator iterator = A.begin();
AMD_STD::vector<BaseClass *>::const_iterator iteratorEnd = A.end()

for(; iterator!= iteratorEnd; ++iterator)
{
 m = dynamic_cast<DerivedClass *>(*iterator); 
 B.push_back(m);
}
 B->MyMethod();

```

The problem is that I'm having a NULL pointer when I try to apply the method and it's generating execution errors.
I think the problem is due to a dynamic\_cast fail. Could Anyone help me with this issue.
Thanks in advance.