• 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: Class Clusters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class Clusters


  • Subject: Re: Class Clusters
  • From: Chris Purcell <email@hidden>
  • Date: Thu, 27 Jun 2002 06:47:16 +0100

You might find http://www.cocoadev.com/index.pl?ClassClusters useful; I wrote a guide there. As to your classes, I suggest you have two interface classes, LCVMatrix and LCVMutableMatrix, with

-(id)longIntMultiply:(long int)scalar
et al

in each. That keeps it implementation-independent.

Don't forget that you *cannot* have methods with the same name taking different arguments in different classes, so you cannot use the scheme as you were hoping.

Kritter out

I'm trying to find a way to create my own class cluster.

I'm trying to create a matrix-algebra library in cocoa that will work with three data types: long ints, floats, and doubles. All of the matrix classes will have the exact same interface, with the exception of the data types passed to the methods:

-(id)scalarMultiply:(long int)scalar
-(id)scalarMultiply:(float)scalar
-(id)scalarMultiply:(double)scalar

The only way I've found to do this is to create six classes: LCVIntMatrix, LCVFloatMatrix, and LCVDoubleMatrix (+ mutable counterparts) to handle this. But, I want my users to be ignorant of the implementation, and only want them to interface with the LCVMatrix class.

Apple's class cluster documentation is abysmal, since it only says 'this is a neat thing to do' but doesn't give any examples or guidelines, only examples of how to subclass a class cluster or using composite objects. How do I create an abstract class? How could I implement operator overloading to pass the various data types to the same method?

--Robert Lee Dotson

'Being pro- or anti-lobbying in itself is a sort of Gentlemen v. Players game. And in American History, it's a long time since the Gentlemen won a match.' --The Siege
_______________________________________________
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.

  • Prev by Date: Re: Quartz blitter/hardware support?
  • Next by Date: NSWindow aspectRatio good for anything?
  • Previous by thread: Class Clusters
  • Next by thread: Keeping from Window from Becoming Main
  • Index(es):
    • Date
    • Thread