adplus-dvertising
frame-decoration

Question

How does the compiler arrange the classes in memory in an inherited class?

a.

The compiler arranges the classes in memory so that the descendants' data members are first in memory.

b.

The compiler arranges the classes in memory so that the base class's data members are first in memory.

c.

The compiler arranges the classes in memory randomly.

d.

The compiler doesn't arrange the classes in memory.

Posted under Reverse Engineering

Answer: (b).The compiler arranges the classes in memory so that the base class's data members are first in memory. Explanation:The compiler arranges the classes in memory so that the base class's (the topmost ancestor) data members are first in memory, followed by the next ancestor, and so on and so forth.

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. How does the compiler arrange the classes in memory in an inherited class?