0

In C++, suppose I have a function dummy(foo& f) that does some computation on the public members of f. Now there is a class bar that publicly inherits from foo, and b is an object of bar. Can I call dummy on b? Or I need to redefine dummy(bar& b)? What is the best practice here? Note that the scenario is a bit different from the scenario where virtual function and runtime polymorphism can be applied.

Zitao Wang
  • 101
  • 2
  • 2

0 Answers0