interview questions shared by candidates
Given two base classes and a class derived from them how might one layout class instance memory so that polymorphism will work correctly. Problem was simplified in that one could assume memory was a series of same-sized slots and methods and attributes took up one slot each.
I thought I did rather well, as I figured out (with some help) all but one aspect of the problem.
hello , could you expand a little on the question and what you cam up with ?
No, I can't really elaborate. It has been almost 3 years, the solution was convoluted, and I think I have blocked it out, since I don't remember much. I believe it involved having place holders for methods and attributes in the base class that carried over to the derived class. But I'd suggest a good compiler book, some time with the C++ compiler, and hours to kill if you really want to know the full answer.