Tricky question on upcasting


hi all,

I was looking for a solution to the below problem. Can someone please help?

I’m given this statement Base * b = new Derived;
just this line.
I know that Both base and derived classes have a virtual (overidden in derived) function called Fun().

Given only the above line, how do i invoke base’s Fun(), instead of Derived’s Fun().

Would appreciate any responses.
Try this: b->Base::Fun();
Topic archived. No new replies allowed.