Amazon Interview Question






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

In next C++ standard x10 you will be able to do same as in Java or C#

- Zerg July 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes but no use, It will create temporary object.

- Anonymous May 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Correct, this can be done.

Simply calling the constructor would create a temporary object, which will be destroyed on the very next line (i.e. the scope of that object would be the line it is getting created).

- Sumeet May 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice

- siva.sai.2020 May 13, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is covered in C++ faq . Here's the link
c++-faq-lite/ctors.html#faq-10.3

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

What is the use case for this scenarios when would we do this ?

- mvishnu2005 February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Pre C++11 we can't call a different constructor of the same class , however in C++11, this is allowed which are called delegate constructors.

class A {
   private:
       int n;
  public:

     A( int numb) { n=number;}

    A() : A(42) {}
}

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

#include <iostream>
using namespace std;

class base{
};

class der : public base {
public:
	der() : base()
	{
		//base();
		cout<<"hello "<<endl;
	}
};

int main()
{
	der d;
	return 0;
}

- siva.sai.2020 February 19, 2013 | 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