Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
namespace X
{
 internal class base
 {

 }
}

namespace X.a
{
  internal class derive:base
  {

  }
}

why does this work?

How can the derive class be derived from the base class when they have 2 diferent namespaces though X.a is an extension?

shouldnt there be a using X in the namespace of X.a or is it implicitly called?


Thanks in advance.
Posted
Updated 15-Oct-12 14:19pm
v3
Comments
Sergey Alexandrovich Kryukov 15-Oct-12 21:28pm    
This is how namespaces work. What's wrong or unusual with that? I don't think it's "extension". All namespace rules are pure naming rules; they carry no semantic, whatsoever. Can this thought help? In case of doubt, just read the namespace section of the manual.
--SA
surendersinghprajapati 16-Oct-12 1:48am    
This works perfect and this is what should be. Please read guidelines for name spaces in case more information needed.

1 solution

A nested namespace should have a dependency on types in the containing namespace. For example, the classes in the System.Web.UI.Design depend on the classes in System.Web.UI. However, the classes in System.Web.UI do not depend on the classes in System.Web.UI.Design.

Check this

http://msdn.microsoft.com/en-us/library/893ke618(v=vs.71).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900