Subclassing appendFormat: for NSMutableString?
Subclassing appendFormat: for NSMutableString?
- Subject: Subclassing appendFormat: for NSMutableString?
- From: "Dr. H. Nikolaus Schaller" <email@hidden>
- Date: Sun, 16 May 2004 16:22:24 +0200
Hi,
I have tried to subclass NSMutableString and learned that it is a Class
Cluster which can not be subclassed unless I want to add more internal
string representations (which is NOT what I want).
What I want is a class that behaves in some aspects like a
NSMutableString but has additional instance variables. A typical
candidate for subclassing.
Documentation recommends: Write a subclass of NSObject that manages an
NSMutableString as an instance variable and write wrapper methods.
Well, but how do I wrap appendFormat: which is the most important
method I intend to provide by the subclass?
There seems to be no chance to get the intended behaviour:
a) no Subclass of NSMutableString - because it is a class cluster
b) no Wrapper around NSMutableString - because you can't wrap methods
with variable argument lists
c) no Category of NSMutableString - because you can't add instance
variables to a Category
The only idea I have is use b) and leave out the appendFormat: method
and replace its calls by [myobject appendString:[NSString
stringWithFormat:...]]. It a little ugly and wasting space&time.
Seems to be a missing functionality of Objective-C/Cocoa. Or do I miss
something?
Nikolaus
_______________________________________________
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.