c++ - Why can the new operator be with an initial value? -


as know new operator can used in following way: int *a = new int(10); , means there int pointer named points initial value equals 10. in http://www.cplusplus.com , couldn't find such direction , want know why new operator can used initial value? similar constructor calling?

why new operator can used initial value?

the initial value (10) goes object (int) *a points.

is similar constructor calling?

yes.


also works auto vars

 int  b (20); 

b initialized 20.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -