• 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: "Smith, Bradley" <email@hidden>
  • Date: Wed, 29 Aug 2001 09:20:24 +0100

No such thing (in C++) as a pure virtual class. Only pure virtual functions
and these can occur anywhere in the class hierarchy. One pure virtual
function makes the whole class abstract. Parents on the abstract class need
not also be abstract however.

Stuart's question is still a valid one. Abstract classes are a useful
feature of C++. How would one go about achieving the same objective (excuse
the pun) in Objective-C?

Brad

> AFAICT you can't. And you wouldn't want to if you could.
> Remember, pure
> virtual classes occur at the top of inheritance trees to define the
> interface to the tree. But in ObjC every class is a
> descendent of NSObject:
> you never define the top of the tree. Even a class that
> functions as a pure
> virtual class is going to have to define init as [super init]
> and dealloc as
> [super dealloc].
>
> Think Java, not C++, here.


  • Follow-Ups:
    • Re: Abstract classes and methods
      • From: Ondra Cada <email@hidden>
  • Prev by Date: NSArchiver?
  • Next by Date: Re: Abstract classes and methods
  • Previous by thread: Re: Abstract classes and methods
  • Next by thread: Re: Abstract classes and methods
  • Index(es):
    • Date
    • Thread