Bloomberg LP Interview Question for Software Engineer / Developers






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

No. It gives compilation error!

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

Of course not. The compiler can't guess which virtual function will be called on runtime, so it can't generate required code from template.

- 10098 September 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

stackoverflow.com/questions/2354210/template-member-function-virtual
In this link, one post with code example is nice (posted on May 24th by "Allopen")

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

You can declare them virtual but there wont be any use of the virtual keyword.

- blueskin.neo November 21, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can make a function virtual inside template class,
but you cannot make a template virtual function inside a class.
Another words:

template <class T> class A
{
  virtual void f(); // possible, creates vtable pointer, class size = 4
};

class A
{
  template <class T> virtual void f(); //impossible: compiler does not know how to make vtable (they will be different for each type) 
};

- Anonymous January 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can make a function virtual inside template class,
but you cannot make a template virtual function inside a class.
Another words:

template <class T> class A
{
  virtual void f(); // possible, creates vtable pointer, class size = 4
};

class A
{
  template <class T> virtual void f(); //impossible: compiler does not know how to make vtable (they will be different for each type) 
};

- sergey.a.kabanov January 13, 2012 | Flag Reply


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