The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Challenge Accepted

Posted by Dave Neuer on November 21, 2000 at 9:08 PM

> C++ suports multiple inheritance big time but what is the gain ??
> If u can give me one good example of multiple inheritance in nature , by nature understanding anything in this world witch has actions and states , i'll accept that java has this lack.
> Until then i'll stay to the ideea that multiple inheritance has no real applicability in any programing language :) .
> I repliyed to your message because i think a good subject.
> Thanx,
> lucas

1) True hermaprhoditism (a la earthworms) where the organism has both male and female gonads and external genitalia. Either partner may penetrate the other during sexual intercourse, and either may fertilize or be fertilized.

In terms of an abstractions:

class male{
data members: penis, testes;
methods: fertilize(ovum)

class female{
data members: vagina, ovaries;
methods: ovulate(), receive(penis)

class earthworm: is a male, is a female{}

2) AM/FM radios

class AM radio{
data member: circuits_to_compensate_for_the_signal_level_differences (compressor?)

class FM radio{
data members: limiting_circuit, discriminator_circuit

class AM/FM radio: is a AM radio, is a FM radio{}


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us