• 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: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)


  • Subject: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • From: DumberThanDanQuayle <email@hidden>
  • Date: Fri, 24 Sep 2004 23:32:06 -0400


On Sep 24, 2004, at 11:07 PM, Ondra Cada wrote:


On 25.9.2004, at 4:52, DumberThanDanQuayle wrote:

Great, this now explains the ivar related problem I noticed and basically _rules out_ method swizzling for what I am trying to accomplish here, which is merely writing a method or protocol implementations only once, instead of multiple times (once for each class with a different super-class). Given that these classes needing a common method implementation have different super-class, they often have different ivar structures as well.

I do not care about classes "looking" like other classes here, that is easily accomplished with protocols (or other techniques like "+poseAsClass" or message forwarding as you mentioned). I am merely looking for a way to write implementations once and then use them in ostensibly unrelated classes. This is barely multiple inheritance.

At the first look, kinda sounds like a plain common-ancestor (like NSObject, if nothing other) category might help here?


Or some refactoring perhaps :)))

Ondra, thanks for responding.

This is multiple inheritance type of problem, but a weaker one. It does not require anything beyond protocols to achieve alternative common appearances for class. More clearly, I want these classes to have a single common implantation of like methods, so when I modify them I do not have to scrounge the source files and make redundant changes. I am want the consistency of these implementation to be explicit.

But these classes need to not appear actually have multiple super-classes. I have a very well defined class hierarchy and I can not change it merely for the freedom to have only one implementations of ancillary protocols. I think I have found my simple solution which writing common method implementations in a separate file and using the C preprocessor macro "#include" to insert that text into my classes where necessary like this:


@implementation mySubClassWithWeakMultipleInheritence

#include "myCommonProtocolImpementation.m"

- (void)someSubClassSpecificMethod
{

NSLog(@"This is someSubClassSpecificMethod of mySubClassWithWeakMultipleInheritence");

}

@end

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
      • From: Ondra Cada <email@hidden>
References: 
 >Is _objc_flush_caches_(Class) necessary to swizzle methods? (From: DumberThanDanQuayle <email@hidden>)
 >Re: Is _objc_flush_caches_(Class) necessary to swizzle methods? (From: Glenn Andreas <email@hidden>)
 >Re: Is _objc_flush_caches_(Class) necessary to swizzle methods? (From: DumberThanDanQuayle <email@hidden>)
 >Re: Is _objc_flush_caches_(Class) necessary to swizzle methods? (From: Glenn Andreas <email@hidden>)
 >Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?) (From: DumberThanDanQuayle <email@hidden>)
 >Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?) (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • Next by Date: Issues while running Modal Window.
  • Previous by thread: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • Next by thread: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
  • Index(es):
    • Date
    • Thread