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
  • God object? Commented Jan 22, 2017 at 18:19
  • 1
    @gardenhead has a good answer. Also see en.wikipedia.org/wiki/Subtyping. Polymorphism in OOP is often referred to as inclusion polymorphism in broader contexts, because there are also other kinds of polymorphism. Commented Jan 23, 2017 at 6:28
  • 2
    What you have there is often referred to as multiple inheritance (multiple interface inheritance in Java and C# as they don't have full multiple inheritance, I have not seem many languages that do full multiple inheritance properly). Polymorphism usually refers to multiple implementations inheriting from a single interface, to that one implementation can stand in for another. Commented Jan 23, 2017 at 23:17
  • That's what my interviewer said about inheritance, but I didn't agree much with him, because what is missing here is the behaviour/implementation inheritance, unlike C++. I reviewed the Gamma et. all introductory chapter of their book and I believe the whole point is, like you said, the ability to substitute an object to another, so the clients don't depend on a particular object, but on interfaces. Interface in Gamma is different from the interface from C# or Java. Gamma considers the object's interface the totatity of its public methods. A type is a name to denote a particular interface. Commented Jan 24, 2017 at 7:27