 Welcome back. In the last segment, we discussed how to split a program over many files, function declarations and definitions and header files. In this segment, we are going to discuss namespaces. So suppose many people cooperatively develop a single program. Now it is possible that several people may define functions with the same name. So it is a little bit cumbersome for you to coordinate if you are writing a small function that you say oh I am going to use the function called f, please do not use a function called f as well. So that coordination is cumbersome and if you do not have the coordination then you may have some name conflicts. So how do we avoid this? This can be avoided using something called a namespace. A namespace is basically a catalogue of names. So effectively the full name of a function f defined in a namespace n is n colon colon f. So if f is defined in two namespaces n and p, then n we can specify which one we mean by writing n colon colon f or p colon colon f. And there are other ways of specifying as well which we will see soon. But basically now we can have unambiguous ways of referring to different functions even if their name is the same because their full name is going to be different. So effectively each programmer could use a different namespace if there is need. So how do you define a namespace? Declaration is simple, defining a namespace is simple, you just write namespace followed by the name of that namespace. In this case the name is n and then inside that block you put in declarations or definitions of names. This creates a namespace with the name n and also defines or declares names inside it. You can add more names into a namespace simply by writing namespace n again and putting names inside that new block in the new position. A name g which is defined without putting it inside a namespace is said to belong to the global namespace. So all the names that you have been defining so far are in the global namespace. So their full name is colon colon g. You could refer to them this way but if you wish. So here is an example of using a namespace. So first I am defining a namespace n and it contains the declaration, actually it contains a definition of g series. So I have put dot, dot, dots to say that the entire body will go there. See there is the definition of LCM. Now in my main program I need to write n colon colon LCM because I want to access this LCM which is defined in this namespace n. Now there is something called the using directive which comes in handy often. So if you have defined a namespace n and you have many names defined in it and you want to access them quite frequently. So you may get tired of writing n colon colon all the time. So what you might do is you might put the following line at the top of your file. So you might say using namespace n, this is the line you put. So for all other references in that file you will be allowed to use any name from n without having to write n colon colon before it. So n colon colon will become implicit. So if I write this directive then the previous program becomes like this. I will write namespace n in GCD and LCM and then I have this using namespace over here. So this using namespace says when I use LCM over here it is implicitly interpreted as n colon colon LCM and I will get the definition which is given in this namespace. So what have we discussed? We have said that namespaces help many people to use the same name and yet combine their work together if needed. Then we discussed the using directive. Next in the next segment we are going to use C++ without simple CPP and we are also going to conclude this entire lecture sequence. So let us take a break.