Why does a virtual function get hidden?
Assuming you intended B to derive from A: f(int) and f() are different signatures, hence different functions. You can override a virtual function with a function that has a compatible signature, which means either an identical signature, or one in which the return type is “more specific” (this is covariance). Otherwise, your derived class function … Read more