Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24568

Re: multiple inheritance in Java

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: multiple inheritance in Java
Date 2013-07-01 21:52 -0400
Organization A noiseless patient Spider
Message-ID <kqtbe7$mth$1@dont-email.me> (permalink)
References <multiple-inheritance-20130702021857@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 7/1/2013 8:31 PM, Stefan Ram wrote:
>    Assume you needed a class ColorPoint in Java:
>
> class ColorPoint extends Position, Color;
>
>    . Would it be so bad to implement this using public fields
>    instead of classical delegation? Public fields:
>
> class ColorPoint
> { public final Color color;
>    public final Position position; ... }
>
>    , usage:
>
> point.color.r = 72;
> point.color.b = 65;
> point.color.c = 41;
> point.position.x = 212;
> point.position.y = 117;
>
>    . Classical delegation style:
>
> point.setR( 72 );
> point.setB( 65 );
> point.setC( 41 );
> point.setX( 212 );
> point.setY( 117 );
>
>    . I only ask, because public fields usually are frowned upon
>    in OOP, but what would be the drawback here, especially when
>    those fields are final?

     Sorry, but I can't make head or tail of your question.  I haven't
been following the prognostications for future Java versions, and the
only versions I know forbid multiple inheritance.  Besides, I don't
see where M.I. comes into the picture: You seem to be asking about
public fields and final fields, not about how to merge multiple
implementations and resolve their potential conflicts.

     Also, what are Position and Color?  It doesn't seem to me that
javax.swing.text.Position or java.awt.Color are candidates.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-01 21:52 -0400
  Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-02 00:09 -0400
    Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-02 08:13 -0400
      Re: multiple inheritance in Java Arne Vajhøj <arne@vajhoej.dk> - 2013-07-04 17:33 -0400
        Re: multiple inheritance in Java Sebastian <news@seyweiler.dyndns.org> - 2013-07-05 08:04 +0200
    Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 13:17 -0400
      Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-02 13:40 -0400
        Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 14:29 -0400
          Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 15:12 -0400
            Re: multiple inheritance in Java Arne Vajhøj <arne@vajhoej.dk> - 2013-07-04 17:23 -0400
              Re: multiple inheritance in Java Arne Vajhøj <arne@vajhoej.dk> - 2013-07-04 17:25 -0400
          Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-02 15:44 -0400
            Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 16:28 -0400
              Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 16:44 -0400
              Re: multiple inheritance in Java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-02 17:13 -0400
                Re: multiple inheritance in Java Jeff Higgins <jeff@invalid.invalid> - 2013-07-02 22:12 -0400
  Re: multiple inheritance in Java Lew <lewbloch@gmail.com> - 2013-07-02 11:53 -0700
    Re: multiple inheritance in Java Steven Simpson <ss@domain.invalid> - 2013-07-03 10:46 +0100
      Re: multiple inheritance in Java lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-07-03 13:01 +0100
        Re: multiple inheritance in Java Steven Simpson <ss@domain.invalid> - 2013-07-03 14:12 +0100
          Re: multiple inheritance in Java lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-07-03 14:49 +0100
        Re: multiple inheritance in Java Arne Vajhøj <arne@vajhoej.dk> - 2013-07-06 22:19 -0400
  Re: multiple inheritance in Java Arne Vajhøj <arne@vajhoej.dk> - 2013-07-04 17:36 -0400
    Re: multiple inheritance in Java Gene Wirchenko <genew@telus.net> - 2013-07-05 11:01 -0700

csiph-web