Built-in types have a constructor

In standard C++ built-in types such as char, int and float can be initialized like any ordinary user-defined type:

 char *pc = new char('a');  int pi= new int(10);	float pf = new float(0.333);

This language extension was introduced to the Standard in order to be compatible with STL containers and algorithms.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: