what's the difference for the following two ways to define namespace?
namespace A.B.C {
public class AA{
}
}
namespace A {
namespace B{
namesapce C{
public class AA{
}
}
}
}
in some where I may have
namespace A{
//some classes
}
namespace A.B {
//some classes
}
namespace A {
namespace B {
//some classes
}
}
Both need to do the same to use class AA by using A.B.C;
Can I use C.AA a;
to specify the AA class in C namespace or I have to use the fall namespace convention: A.B.C.AA a;
to avoid possbile confliction?
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
History: The name C is derived from an earlier programming language called BCPL (Basic Combined Programming Language). BCPL had another language based on it called B: the first letter in BCPL.
They're the same. If you look at this code in .NET Reflector:
namespace A {
namespace B{
namespace C{
public class AA{
}
}
}
}
you get this:
namespace A.B.C
{
public class AA
{
// Methods
public AA();
}
}
Both methods are compiled to exactly the same intermediate language code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With