Bloomberg LP Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Actually there is a global "operator new" that can be overridden on both a "per class" basis *or* globally overridden. It depends on whether the definition of the operator is within a class scope or the global scope.

The default behavior of new is defined in the C++ standard, and does not vary. However, it the behavior if the new operator is overloaded, there is no guarantee that initialization (or that anything at all will happen). The use of the new operator will be governed by, and limited to, whatever functionality is in the overloaded function definition.

- Wandering programmer February 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This question doesn't make sense..If new is overloaded then it has to do whatever the overloaded function is defined as.Constructor will only do initialization without any storage allocation.

- mm March 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A few differences:
1. If class that has an overloaded new operator, can not use base class's values to initialize its own values in its new operator. This is possible only in the constructor.
2. If new is overloaded for class B and D inherits from B, then "new D()" will call B's new operator. This behavior is different from how constructors behave.
3. If new [] is overloaded for class B then "new B[N]" gets only one chance to initialize N objects. You will need a loop. With constructors, however, one constructor will be called for each object. No loop needed.

- sam July 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

u cannot overload new operator

- kazz February 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

why the hell not?
using overloaded new , u gotta first make space, then assign to object, then initialize it... constructor jus initializes the object for u...

- Anonymous February 18, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

please distinguish between "new operator" and "operator new"
new operator cannot be overloaded; you can only overloaded "operator new"

- Anonymous February 23, 2010 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More