• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Abstract classes and methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abstract classes and methods


  • Subject: Re: Abstract classes and methods
  • From: "Michael B. Johnson" <email@hidden>
  • Date: Wed, 29 Aug 2001 08:12:58 -0700
  • Organization: Pixar Animation Studios

stuartbryson wrote:
> Date: Thu, 30 Aug 2001 22:55:48 +1000
> From: stuartbryson <email@hidden>
> To: Cocoa Developer <email@hidden>
> Subject: Re: Abstract classes and methods
>
> I find it quite amusing that this is the exact example that I need it
> for (except that I am working in 3D rather than 2D). I have a 3DObject
> and then Sphere and Cube both inherit from 3DObject. I do not want
> anyone (me) to be able to instantiate 3d object. It is easy to say
> "Please don't instantiate 3DObject" to those who might use my code, but
> if I could force it like in C++ this would ensure the quality of the
> program etc etc.
>
> Stuart

The way I did this exact thing in WavesWorld way back when was by having a formal "Renderable"
protocol - any object that implemented the various methods defined in the protocol was, by
definition, renderable. This let me mix things like cameras and geometry that didn't have a common
base class in a very nice way, where in C++ I would have defined an abstract base class with all
pure virtual functions and then done a mix in with the appropriate concrete superclass.

From my language agnostic perspective, this is the same thing.



--> Michael B. Johnson, Ph.D. -- email@hidden
--> Studio Tools, Pixar Animation Studios
--> http://xenia.media.mit.edu/~wave


  • Follow-Ups:
    • Re: Abstract classes and methods
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Required in .h
  • Next by Date: Java and C
  • Previous by thread: Re: Abstract classes and methods
  • Next by thread: Re: Abstract classes and methods
  • Index(es):
    • Date
    • Thread