C#.NET — handling type name conflicts when Point class exists in both n1 and n2 namespaces.
C# Programming
Namespaces
Difficulty: Medium
Choose an option
-
AImport n1 inside Main() and declare Point.
-
BUse n1.Point and n2.Point fully qualified names after imports.
-
CUse using n1 and using n2 inside Main().
-
Dusing n1; using n2; then use n1.Point and n2.Point explicitly.
Answer
Correct Answer: using n1; using n2; then use n1.Point and n2.Point explicitly.
Explanation
Fact:When two namespaces contain the same class name, you must qualify with the namespace to disambiguate. Both using directives can be present, but class references must be fully qualified.
Final Answer:using n1; using n2; then use n1.Point and n2.Point explicitly.