6
Answers

Namespace

Maha

Maha

9y
700
1
This program is a modification of original program which is give in the following website
http://www.dotnetperls.com/namespace

I wish to know why modification is not working. Problem is highlighted.


using System;
using A.B.C;

namespace E
{
using D;

class Program
{
static void Main()
{
// Can access CClass type directly from A.B.C.
CClass var1 = new CClass();

// Can access DClass type from D.
DClass var2 = new DClass();

// Must explicitely specify F namespace.
F.FClass var3 = new F.FClass();

// Display types.
Console.WriteLine(var1.ToString());//A.B.C.CClass
Console.WriteLine(var2.ToString());//D.DClass
Console.WriteLine(var3.ToString());//F.FClass

Console.ReadKey();
}
}
}

namespace A
{
namespace B
{
namespace C
{
namespace D
{
public class CClass
{
}
}
}
}
}

namespace D
{
public class DClass
{
}
}

namespace F
{
public class FClass
{
}
}
/*
A.B.C.CClass
D.DClass
F.FClass
*/

Answers (6)