How is inheritance implemented at the memory level?

Posted by cambr on Stack Overflow See other posts from Stack Overflow or by cambr
Published on 2010-04-21T04:41:56Z Indexed on 2010/04/21 4:43 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

Suppose I have

class A           { public: void print(){cout<<"A"; }};
class B: public A { public: void print(){cout<<"B"; }};
class C: public C {                                  };

How is inheritance implemented at the memory level?

Does C copy print() code to itself or does it have a pointer to the it that points somewhere in A part of the code?

How does the same thing happen when we override the previous definition, for example in B (at the memory level)?

© Stack Overflow or respective owner

Related posts about c++

Related posts about memory