POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 10:29:04 EDT (-0400)
  Re: Object Oriented POV code  
From: Dan P
Date: 20 Feb 2004 10:50:15
Message: <40362cb7$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:4035eb87@news.povray.org...
> Darren New <dne### [at] sanrrcom> wrote:
>
> > Imagine Java with no inheritance of functions, only "inheritance" of
> > what java calls interfaces. Does it stop being "object oriented"? Most
> > people working in the field of designing programming languages I think
> > would say "no, it's still OO".  It still has objects, dynamic dispatch,
> > memory management, classes, instances, etc. Just not inheritance.
>
>   If you inherit class X from class Y you are saying "X is a Y" (that is,
> it implements everything Y implements and behaves like Y).
>   Y may be completely abstract, meaning that it does not implement
anything
> itself. However, deriving a class from it still means that the derived
> class "is a Y".
>   If you make a class which implements an interface you are doing
inheritance.
> Limited perhaps, but still inheritance.

I have to disagree with this: If X derives Y, X is still X, but inherits the
methods and members of Y. Also, Y is not an X -- for example, if Y was a
Stream and X was a RandomAccessStream, A RandomAccessStream contains methods
and members of a Stream, but it is still a RandomAccess Stream. A Stream is
not a RandomAccessStream from the other way around as well so X cannot
actually be Y. The Stream may contain functionality to connect to some
device, but doesn't have the capability of randomly accessing it. The
RandomAccessStream has ability to connect to some device because it
inherited that ability from a Stream. That is why the use words like
"instanceof" instead of "equals" to check if a class inherits from another
class.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.