Those aren’t the same. My example had 2 methods, you changed it to 1 replaced method. You might benefit from reviewing the documentation on methods and running code in the REPL to understand and verify the behavior.
govorunov:
Methods are not ‘overwritten’ but hidden.
Yes they are, the warning for method overwriting literally says it. The more serious issue there is the quoted excerpt was clearly denoted as a hypothetical language that is not Julia.