• 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: Creating a class cluster
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a class cluster


  • Subject: Re: Creating a class cluster
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 29 Jul 2002 14:21:21 +0200

On Monday, July 29, 2002, at 03:06 , Greg Titus wrote:

An alternative to this is to have your super class be a singleton by implementing +allocWithZone:.

+ alloc {
static MySuperClass *sharedInstance = nil;

if (!sharedInstance)
sharedInstance = [super alloc];
return sharedInstance;
}

I'd say this is not the best idea, at least not for a relative newbie. How would you make instances of those hidden subclasses? Directly using NSAllocateObject, or will you make +myAlloc to be able to reach the original one?
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Creating a class cluster (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Dereferencing a pointer in ObjC?
  • Next by Date: Re: detect control key
  • Previous by thread: Re: Creating a class cluster
  • Next by thread: Re: Creating a class cluster
  • Index(es):
    • Date
    • Thread