C# Programming - Namespaces - Discussion

Discussion Forum : Namespaces - General Questions (Q.No. 6)
6.
If a class called Point is present in namespace n1 as well as in namespace n2, then which of the following is the correct way to use the Point class?
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            import n1; 
            Point x = new Point();
            x.fun();
            import n2;
            Point y = new Point(); 
            y.fun();
        }
    }
}
import n1; 
import n2;
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        {
            n1.Point x = new n1.Point(); 
            x.fun();
            n2.Point y = new n2.Point(); 
            y.fun();
        }
    }
}
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    {
        static void Main(string[] args)
        {
            using n1;
            Point x = new Point();
            x.fun();
            using n2;
            Point y = new Point();
            y.fun();
        }
    }
}
using n1;
using n2; 
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            n1.Point x = new n1.Point(); 
            x.fun();
            n2.Point y = new n2.Point(); 
            y.fun(); 
        } 
    } 
}
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
3 comments Page 1 of 1.

Kedar said:   1 decade ago
Using keyword is used in C# instead of import.

Roy said:   1 decade ago
What is the difference between option B and option D?

Ankit vs said:   9 years ago
WHAT WILL HAPPEN IN THIS CASE? Please explain.

namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
using n1;
Point x = new Point();
x.fun();
using n2;
Point y = new Point();
y.fun();
}
}
}

Post your comments here:

Your comments will be displayed after verification.