views:

187

answers:

1

If there was a base class DeriveMe that had a function virtual void DoSomething(int) and a class that inherits DeriveMe called DerivedThat that had a function void DoSomething(SomeEnum)...would the DerivedThat override the base class DoSomething because enums evaluate to ints during compile time in C++?

I could try this by making DoSomething pure virtual and compile/run it to see if it works but this is my first stackoverflow question so I'd rather just ask it.

+7  A: 

No, DerivedThat will hide the function from the base class, since the signatures don't match. enums do not evaluate to int, as they are a distinct type.

See the C++ FAQ, sections 23.9 and 29.19.

greyfade