Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++

Question: 1 / 565

What happens if operator new[] is overloaded in a class?

It handles individual object allocations

It's invoked when creating arrays of class objects

When operator new[] is overloaded in a class, it means that the class has a specific way of allocating memory for arrays of objects. This is different from the global new[] which is used for allocating memory for arrays of non-class objects. Option A is incorrect because operator new[] is used for allocating memory for all objects in a class, not just individual ones. Option C is incorrect because the overloaded operator new[] only applies to that specific class and not the global one. Option D is incorrect because overloading operator new[] does not disable the default constructor, which is used for creating objects in a class. This is why option B is the correct answer, as overloading operator new[] allows for customized memory allocation when creating arrays of objects in a class.

Get further explanation with Examzify DeepDiveBeta

It replaces the global new[]

It disables the default constructor

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy