Skip navigation.
 
mlRE: Class hierarchy question
FROM : Ben Dale
DATE : Thu Jul 27 03:34:56 2006

Firstly, apologies for replying to your thread ;)

Now, I envisage that the myObject class will contain methods and 
instance variables used by my application to identify each of these 
buttons and fields (and other object types as the application is 
extended) over and above the information provided by their NS-
Counterparts.  I'm only in whiteboard phase at the moment, so the 
myObject may not be required after all.

Cheers,

Ben

On 27/07/2006, at 11:18 AM, Jonathan Grynspan wrote:

> It's possible to "inject" a class into the class hierarchy (look up 
> "class posing") but odds are, you're not looking at the problem 
> from a Cocoa mindset. Can you explain what "myObject" adds?
>
> If myObject has extra support methods that you want your classes to 
> be able to use, you can instead create a category off of NSObject.
>
> -Jonathan Grynspan
>
> On 26-Jul-06, at 9:14 PM, Ben Dale wrote:
>

>> Hi List,
>>
>> I'd like to create a set of classes (myButton, myField) that 
>> inherit from another newly created class (myObject).  I'd also 
>> like these sets of classes (myButton and myField) to present 
>> actual buttons and fields on the screen that can be moved and have 
>> their styles modified along with various other attributes 
>> available to instances of NSButton and NSTextField.
>>
>> I'm fairly new to Objective-C/Cocoa (so forgive my terminology 
>> glitches) and am trying to work out the best way to design the 
>> inheritance structure knowing that myObject will be required to 
>> extend NSObject, and myButton and myField will ideally need to 
>> extend NSButton and NSTextField respectively: (fixed width font 
>> may be required for lame ASCII art)
>>
>> NSObject
>>  |
>> myObject---,
>>  |        \
>>  |          \
>> NSButton  NSTextField
>>  |          |
>> myButton  myTextField
>>
>> 1/ Is the above possible?
>> 2/ Is there a better way to do it?
>> 3/ Would the best way be to have myButton and myField classes sub-
>> class myObject and contain a pointer to instances of NSButton or 
>> NSTextField that they pass their own parameters to?
>> 4/ Am I going about this entirely the wrong way?
>>
>> Cheers,
>>
>> Ben
>>
>> _______________________________________________
>> MacOSX-dev mailing list
>> <email_removed>
>> http://www.omnigroup.com/mailman/listinfo/macosx-dev

>

Related mailsAuthorDate
mlRE: Class hierarchy question Ben Dale Jul 27, 03:34
mlRe: Class hierarchy question Jonathan Grynspan Jul 27, 07:28