← Namespaces

Fix: Redefinition, with Namespaces

hard

This has two functions named convert, both taking a single double – and unlike Module 4’s overloading exercises, identical parameter types mean the compiler has no way to tell them apart. Submit as-is and read the “redefinition of convert” error before changing anything – this is the exact class of error from Module 3, except this time the fix isn’t merging duplicate logic, it’s separating two functions that were never actually duplicates, just unluckily same-named.

Wrap each version of convert in its own namespace (weight and distance are reasonable names, but any pair of distinct names works), and update the two call sites in main to qualify each call appropriately.

Your solution

"Run" uses the sample stdin ("10 5"). "Submit" checks your code against all 2 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution