Interview Question






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

The actual fault is - when the compiler see "A a();" it takes it takes 'a' as function having return type 'A'. Usually implicit invocation of default constructor is done by "A a" or "A a = A();"

- Dilip October 22, 2010 | 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

compile failure...

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

I think you should tell WHy COmpile failure?

- Aditya October 16, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

A a();
This is declaration of a function which takes no parameters and returns A.

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

the problem is in the line

A a();

as the constructors has no parameters 
here the compiler has no clue of calling the constructor and make such an object hence it throws the exception when you try to use the object.

remove the brackets and call as

A a;
this works !!

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

main doesn't have "return 0;"

- lingrong1988 October 17, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

main in c++ returns 0 by default ..

- Frodo October 19, 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