new features of ansi c++ standard

Introduction -: The ANSI C++ standard add several new features to the original c++ specification. Some are added to provide better control in certain situation other are added for providing convenience to c++ programmers.

The important features are here as like

1 . New data type

  • Bool
  • wchar_t

2. New Operators

  • const_cast
  • static_cast
  • dynamic_cast
  • reinterpret_cast
  • typeid

3. class implementation

  • explicit constructor
  • Mutable member

4. Namespace scope

5. Operator keyword

6.New keywords

7. New headers

 

New Data type-: The ANSI c++ added two new data type to enhance the range of data types available in c++. They are BOOL and wchar_t.

The Bool data type– the data type bool has been added to hold boolean value true or false. The value true and false have been added as keyword to the c++ language. the bool type variable can be declared as follows as like

bool b1;
b1=true;
bool b2= false;

the default numeric value of true is 1 and false is 0

cout <<"b1= "<< b1;
cout  <<"b2= "<<b2;

the output display the following 
b1=1
b2=0;

The wchar_r data type –: The character data type wchar_t has been defined in ANSI c++ to hold 16 bit wide character. 16 bit character are used to represent the character set of language that have more than 255 character.

ANSI c++ also introduce a new character literal known as wide_character literal which use two bytes of memory. It’s start the letter L as like..

L'xy'  //wide character

 

New Operators-:  We have used several operator in several program of c++ language.We know that the cast are used to convert the value from one type to another. This is necessary in situation where automatic conversion are not possible.

The static_cast operator -: This operator is used for any standard conversion data type . It can also be used to cast base class pointer into a derived class pointer. For like

static_cast <type>(object)

The const_cast operator-: It is used to explicitly override const or volatile in a cast . it takes as like

const_cast<type>(object)

 

The reinterpret_cast operator-: this is used to change one type into a fundamentally different type for example

reinterpret_cast<type>(object)

The dynamic cast operator-: It is used to type of  an object at run-time. Its main application is to perform cast on polymorphic object. as like

dynamic_cast <type>(object)

The typeid operator -: this operator is use to obtain the types of unknown object such as their class name at runtime. for example

char *objectType =typeid(object).name();

Class implementation -: C++ add two unusual keywords Explicit and Mutable for use with class member.

Explicit keyword-: It is use for declare class construction to  be “explicit ” constructors.

Mutable keyword-: A class object or a member function may be declared as const thus making their member data not modifiable.

Namespace scope –: C++ added added a new keyword namespace to define a scope that could hold global identifiers. Example of in c++ are class , function and templates are declared with  the namespace namespace std.

Defining a namespace-: we can define a namespace in our program. the syntax for defining a namespace is similar to the syntax as like

namespace  namespace_name
{
    //declaration
}

 

Operator keywords -: C++ has several operator keyword. these are the

&&             and 
!!             OR 
!              NOT
!=             NOT_EQ
&              BITAND
|              BITOR
^              XOR
~              COMPL
&=             AND_E1
|=             OR_EQ
^=             XOR_EQ   

 

New Keyword- : c++ has support new several keyword.there are 64 keyword in c++ . as like auto,enum,new,this etc.

New Headers-: c++ has defined a new way to specify header files. They don’t use .h extension to filenames. as like

#include<iostream>
#iclude<fstream>

 

More related topic is available here 

Manipulated string in c++ 

Standard template library in c++

Leave a Comment