будет работать. Тогда вы можете сравнить указатели, как вы сравниваете сейчас.
ел бы получить некоторую информацию о передовом опыте при сравнении указателей в таких случаях, как этот:
class Base {
};
class Derived
: public Base {
};
Derived* d = new Derived;
Base* b = dynamic_cast<Base*>(d);
// When comparing the two pointers should I cast them
// to the same type or does it not even matter?
bool theSame = b == d;
// Or, bool theSame = dynamic_cast<Derived*>(b) == d?