When we allocate memory space for an object using 'new', will it call a constructor?

158. When we allocate memory space for an object using "new", will it call a constructor?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, when we allocate memory space for an object using the "new" operator, it will call the constructor. But when we allocate memory space for an object using the "malloc ()" function, it will not call the constructor.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.