C++ FEATURES – A BRIEF EXPLAINATION OF KEY FEATURES OF C++

C++ FEATURES - MOULDINGFUTURE

The traditional way to include the I/O header according to the old-style skeletal Program is as follows :

  • #include<iostream.h>

Here, this causes inclusion of the file iostream.h in the program. In general, an old-style header file will use the same name as its corresponding new-style header.. But, the with a little difference of .h present in old-style and not in new-style headers.

Generally, all the C++ compilers support the old-style headers. However, there’s no recommendation for using old-style headers in new C++ programs as now, they are out of date.

 

2. NAMESPACES

Whenever we include a new-style header in our program, std namespace contains the contents of that particular header. Generally, a namespace is a declarative region.

Furthermore, the purpose of a namespace or its work is to localise the names of Identifiers.. So as to avoid name collisions. Also, the elements which we declare in one namespace are totally different from elements we declare in other namespace.

Originally, the names of the various C++ library functions, etc., were simply put into the Global namespace as in C. However, with the advent of new-style C++ headers.. The placing of contents of these headers is in the std namespace. Let’s have a look on the following example,

using namespace std;

The above statement brings the std namespace into visibility. That means it puts std into the Global namespace. After the compilation of this statement, there is no difference between working with an old-style header and a new-style header.

Furthermore, one other point for the sake of compatibility.. When a C++ program includes a C header like stdio.h, its contents are put into the Global namespace. Thus, allowing the C++ compiler to compile C-subset programs.

Thus, it was all about THE C++ FEATURES – A BRIEF EXPLAINATION OF KEY FEATURES IN C++.. 

 

Leave a comment

Your email address will not be published. Required fields are marked *

20 thoughts on “C++ FEATURES – A BRIEF EXPLAINATION OF KEY FEATURES OF C++”