Course Object Oriented Programming

Namespace

Course's Page 12 min Text by
User Image
Allan Garcia

In this class, we will see how namespace works on C++.

C++ libraries

In the last class, we had the following programme:

#include <stdio.h>
#include <algorithm>

int main() {
    int x = min(1, 2);
    printf("%d", x);
}

In it, we include the library algorithm and call the function min(). According to Reference, that function is actually present in the library we added, but as we saw, we got an error when trying to compile and run the program.

To understand this error a bit better, let's look at some code from the C++ libraries, which we saw how to find in the last class.