Preparing to use a class in C++ Programming:-

A program that uses a class is said to call the methods of the class. It might be called the calling program of the methods.

Before using a class there are two preliminary mechanical steps that you must take. The first is to include the definition of the class in your program; this is very similar to the way in which a header file defining one class had to include the definitions of any other classes that it used. As before, this is done with a #include statement similar to the ones that you have used before to include various system libraries such as iostream. The format in this case is subtly different from that used for system libraries:

#include "<classfile>"

Here classfile is the name of the file on your computer that contains the header file. It is almost always best to store it in the same directory as your program, but this is not essential. It is customary and good practice for the name of the file to also be the name of the class, but this is not enforced; the compiler that processes this statement will infer nothing from the name of the file.

The difference between this include statement and those used for system libraries is that quotation marks are used rather than angled brackets to enclose the file name. Contrast the two:

#include <iostream>
#include "classfile.h"

The rule is simple: use angled brackets for system libraries and quotation marks for files written by you or other programmers. Header files are the only files that should ever be included this way; unfortunately, including an
implementation file or a program in this way will probably not generate an error from the compiler, but it certainly is an error and will cause all sorts of problems. Never do it.

The second mechanical detail is that you now need to be able to compile programs that are stored in more than one file. One file will be the program that you write yourself and the other will be the implementation file of the class. While you don’t need to know what’s in this second file, you do need a copy of it, probably in the same directory as your program. As you’ve probably come to expect by now, the way in which you compile programs that use a class’s implementation file is different on different C++ systems.