May 2010
Intermediate to advanced
1272 pages
61h 18m
English
The purpose of namespaces is to enable a better organization of types. Regarding this, there are situations in which an object’s hierarchy could expose two different types with different behaviors but with the same name. For example, imagine you have two Person classes; the first one should represent a business contact, and the second one should represent your friends. Of course, you cannot create two classes with the same name within one namespace. Because of this, you can organize such types in different namespaces avoiding conflicts. The code in Listing 9.2 shows how you can define two Person classes within two different namespaces.
Listing 9.2 Avoiding Conflicts with Different Namespaces
This is the way how ...
Read now
Unlock full access