> Given two solutions: [...] > > Assuming that there are (a lot) more other members and > methods in both classes (which are accessed within the > class, not cross-class), and further assuming that > the A class is being instantiated a *lot*: > What would the runtime impact of these two approaches considering > CPU time and memory used? > > I would guess that solution 1 would be slightly more > efficient, both memory and CPU-wise.
Correct; in solution 2 class A will need the parent pointer to resolve C at runtime. > Or am I overlooking something here where due to the > nested stack frames of solution 1, the actual CPU > or memory usage is higher than expected? Doubtful. /grubba