Hi
Is there a difference between having static and dynamic cast in this scenario? The output is the same.
THX
Code:Base* pb = new Derived(); if(Derived* pd2 = static_cast<Derived*>(pb)) // true { pd2->get_price(); // calls Base::get_price() pd2->get_rate(); // calls Derived::get_rate() pd2->calc(); // calls Derived::calc() (it overrides virtual Base::calc()) } if(Derived* pd = dynamic_cast<Derived*>(pb)) // true { pd->get_price(); pd->get_rate(); pd->calc(); }