posted 22 years ago
Not quite. The thing to remember here is that the thing that identifies a function is the function-name PLUS THE ARGUMENT LIST.
So, in your second example, TwoClass'es "getNumber( int i )" does NOT override OneClass'es "getNumber()" since they have different argument lists, and are therefore different functions.
In fact, TwoClass now has two functions : getNumber() and getNumber(int i).
Of course, OneClass still only has getNumber(), and it isn't affected by anything you've done to TwoClass - hence the compiler error.