.NET furthers the scope of OOP by compartmentalizing objects within namespaces, as an excellent means of categorizing and personalizing common and related fields, classes , structs or interfaces as a collection , as well as other namespaces known as nested namespaces! When including namespaces in an application, C# uses the " using " keyword to do that, whereas VB specifies " Imports " .
This is what facilitates and advances proper reusability and OOP practices. Devoid of this, you would have little structure. Creating a library of common class filled namespaces makes for a well-created application, always having modular components ready for use.
[C#]
namespace JimsEstate {
public class House { ... }
public class Car { ... }
public class Garage { ... }
}
[VB]
Namespace JimsEstate
' Classes and other types of members go here
End Namespace
Here we have the namespace JimsEstate that contains a House, Car and Garage. All are neatly categorized together, and confusion in minimized, thus namespaces. Naming namespaces could easily extend beyond this. JimsEstate could be named JimsEstate.Land.NewYork.LongIsland, if you so choose. That's cool!
At any rate, we'll now look at one of the component types within - classes .
Comments