Continued from Interview questions for OOP programmers:

  • inheritance: I would accept pooter's definition or one similar. You need to convey the idea of a class or similar concept as a basic building block, and then other classes which derive their basic functionality from the base class and extend it. The Circle/Square/Shape example is a classic, but you have to be prepared to explain it, not just trot it out and grin like a fish.
  • polymorphism: Here I'm looking for the candidate's understanding of the benefit of polymorphism, not just a simple definition. I'll refer to my own definition there. They key is understanding that different behaviours are implemented based on type.
  • encapsulation: The definitions there are not bad. I look for someone to be able to explain the idea of data hiding and to realize that the interface is a contract with the outside world, but the guts of the object can change at need.
  • aggregation: I typically don't ask this one. Magenta's writeup pretty much says it all.
  • multiple inheritance: Here we're looking for the ability to distinguish between interface inheritance and implementation inheritance a la C++. A Camp Chaos - James Hetfield "Multiple Inheritance BAD!" is good for a laugh, but needs to be backed up.
  • interfaces: Ideally a candidate can talk about the benefits of an interface over multiple inheritance (see above) but also understands how interfaces add flexibility to OOD: any object can implement an interface and be passed to a method that expects that interface.
  • templates: I don't usually ask this question, but if a candidate has C++ experience they should know enough about the STL to talk to this point. Someone who's used Microsoft's ATL should do well here, too.
  • operator overloading: The node contains more detail than I would ever want. A simple discussion of "+" used for String concatenation would do me, if I asked this question at all, which I rarely do with Java candidates.

For further reading, I recommend the excellent Thinking in Java by Bruce Eckel (www.bruceeckel.com).

Log in or register to write something here or to contact authors.