• 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: Beginner's questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner's questions


  • Subject: Re: Beginner's questions
  • From: "R. Tony Goold" <email@hidden>
  • Date: Tue, 16 Oct 2001 12:42:14 -0400

> Q) What about abstract class (in the java meaning of abstract class) ?
> A) I've seen the previous answer and ok but it's still too bad...

The ObjC veterans can probably give you a better answer on how to do this
once you make it clear you really want to do it, but the way I would do it
is:

-(id) init
{
[self autorelease];
if (throw_exception_for_abstract_init)
{
[NSException raise:@"AbstractInstantiationException"
format:@"Attempt to instantiate abstract class: %@.", [self
class]];
}
else
{
NSLog(@"Attempt to instantiate abstract class: %@.\n", [self class]
);
}
return nil;
}

Note: This is not tested code. It may suck at best, but it conveys the
general idea. I'll leave it to others to suggest a better method.


Cheers,
Tony


References: 
 >Beginner's questions (From: Philippe Magdelenat <email@hidden>)

  • Prev by Date: Re: Client/Server followup
  • Next by Date: Passing an NSImage between processes
  • Previous by thread: Re: Beginner's questions
  • Next by thread: Re: Beginner's questions
  • Index(es):
    • Date
    • Thread