Templates in C++ allow functions and classes to work with multiple data types without needing separate code for each type. The document discusses function templates and class templates. It also covers files in C++, including opening, closing, reading from and writing to files using ifstream, ofstream and fstream classes. Input/output operations on files can be performed using functions like get(), put(), read() and write().