Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • so then it sounds like since Class A inherits from Class B, every object of type A contains a hidden reference to an object of type B? Commented Dec 3, 2009 at 20:33
  • 1
    @jbu: It's more than a reference it's a base class sub-object. Every A instance contains a complete B instance as a sub-object. Inheritance is used to express "is a" relationships, so every A is also a B. Commented Dec 3, 2009 at 20:36
  • 1
    Inheritance is consider an "is-a" relationship. A "is-a" B. You can think of class A as a B with extra stuff. You can treat an A as if it were a B. Commented Dec 3, 2009 at 20:36
  • 2
    Rather, public inheritance is considered an "is-a" relationship. Commented Dec 3, 2009 at 20:39