Bloomberg LP Interview Question for Software Engineer / Developers






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

Make dtors private

- Anonymous August 08, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is correct, and the explanation is, if the object is on the stack the compiler has to put a call to its dtor at the end of the scope, and that's a public call, which of course isn't allowed.

- JeffD January 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

dont get it.

if you use new keyword which is not overloaded, then it will be created on the heap only.

- AK August 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

private ctors, etc. and a factory method to create the object (using new)

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

I think creating it as static class

- sridhar August 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

right ans is use Named Constructor Idiom concept

- sunny August 08, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Private constructor
Named Constructor Idiom

parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.21

- Ashish August 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Make constructors private. Named Constructor Idiom.

- Richa Aggarwal November 10, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You cannot make sure. Example:

class X
{
  private:
    ~X () {}
};

void f ()
{
  char p [1000];

  X* x = new (p) X ();
}

destructor in private, but x is on stack

- Leo March 10, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

C++ is not a policeman. You cannot even prevent from others using you private members. Example:

#define private public

// include here someone else's code --->
class X
{
private:
void f () { cout << "f" << endl; }
};
// include here someone else's code <---

#undef private

struct Y : X
{
void g ()
{
f ();
}
};

Voila - you are using other class private function!

- Leo March 10, 2012 | 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