Re: Terminology

From: Dave Harris (brangdon_at_cix.co.uk)
Date: 12/24/03

  • Next message: Phlip: "Re: TDD and Refactoring"
    Date: Wed, 24 Dec 2003 13:06 +0000 (GMT Standard Time)
    
    

    universe@covad.net () wrote (abridged):
    > You didn't say anything about MI in what I replied to.

    Here it is again:

       Another difference is that Java tends to combine different
       methods if they have the same name and signature. For
       example:

         interface Interface {
             public void method();
         }
         
         class Impl {
             public void method() {}
         }
         
         class Derived implements Interface extends Impl {
             // No definition of method here!
         }

    The final class, Derived, has two parents: Interface and Impl. That is
    Java code. It is an example of multiple inheritance (of interface and
    implementation). The corresponding C++ would be like:

        class Interface {
        public:
            virtual void method() = 0;
        };
        
        class Impl {
        public:
            virtual void method() {}
        };

        class Derived: public Interface, public Impl {
        public:
            virtual void method() {
                Impl::method();
            }
        };

    Again we see the multiple inheritance. Without the definition of
    Derived::method(), Derived would be an abstract class in C++ even though
    it isn't in Java.

    So you are wrong to say there was no multiple inheritance in my article.
    Perhaps you just missed it through not knowing Java very well (that is why
    I now include the C++ version). I have snipped the rest of your reply,
    because it is all based on the same misconception, and anyway mostly just
    repeats what you said earlier. I know you like to think you can teach me
    C++, but I wish you wouldn't.

    -- Dave Harris, Nottingham, UK


  • Next message: Phlip: "Re: TDD and Refactoring"

    Relevant Pages

    • Re: Multiple Inheritance In Java
      ... > cause multiple objects of Object to exist in the code which could be ... There are other approaches to multiple inheritance that don't use the C++ ... suspect that if Java had been defined to have MI, then the ... Java-like language that only allowed interface names to be ...
      (comp.lang.java.programmer)
    • Re: Multiple Inheritance
      ... Then, to me, it can be read "Multiple inheritance, as done in C++, ... was discarded from Java". ... that multiple interface inheritance is not multiple inheritance. ... showed that your quoting of "Gosling" (if he really did write ...
      (comp.lang.java.programmer)
    • !Re: Why cant C# or Java support multiple inheritance? But inherit multiple interfaces instead??
      ... that's what the Java folks did. ... Inspiration for the Interface ... In Java you included multiple inheritance of interface, ...
      (comp.object)
    • Re: Why not multiple inheritance in C# and java
      ... >>> Can Anyone explain me exactly why multiple inheritance not used in java ... >> language which can then mean additional complexity in the code (whether ... >> of interface in both .NET and Java. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Terminology
      ... Derived is a concrete class with Interface.method being ... > interface Interface { ... > class Impl { ... > basically just like Java. ...
      (comp.object)