Expedia Interview Question for SDE-2s


Team: LSB
Country: United States
Interview Type: Phone Interview




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

Virtual function lookup tables stored within an object. When you invoke a virtual member function in your code, the compiler sets a function identifier (really its an offset into this lookup table) that says which function you should invoke. Now if a subclass want to override a given function, it overwrites that entry in the lookup table for the subclass and viola, when time to invoke the overridden function, you jump to the correct one.

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

class Animals {

public:
virtual void eat () = 0;
};
class dog : public Animals {
public:
void eat () { do stuff; }
};
class cat : public Animals{
public:
void eat () { do stuff; }
};
int main ()
{
dog d;cat g;
Animals *p;
p = &d;
p->eat () // dog eat wiil be called,
p = &g;
p->eat(); // cat eat will be called

- Akash September 23, 2014 | 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