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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -