• 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
Objective-C Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C Question


  • Subject: Objective-C Question
  • From: Dave <email@hidden>
  • Date: Mon, 11 Mar 2013 20:21:30 +0000

Hi,

Take the following example:

@interface BaseClass

+(NSMutableDictionary*) newDict;

@end

@implementation BaseClass

+(NSMutableDictionary*) newDict
{


return [[NSMutableDictionary alloc] init];
}


@class NewClass;

@interface NewClass : BaseClass

+(NSMutableDictionary*) newDict;

@end

#import "BaseClass.h"

@implementation NewClass

+(NSMutableDictionary*) newDict
{
NSMutableDictionary*	myDict;

myDict = [[super class] newDict];
[myDict setObject:@"Some Data" forKey:@"someKey"];

return [[NSMutableDictionary alloc] init];
}

@end




I had assumed (and I thought I'd done something like this before) that the:

myDict = [[super class] newDict];

statement would call newDict in BaseClass???? Instead it calls the version in NewClass and goes into an infinite loop!!

Any help greatly appreciated.

Cheers
Dave




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Objective-C Question
      • From: Seth Willits <email@hidden>
    • Re: Objective-C Question
      • From: H Miersch <email@hidden>
    • Re: Objective-C Question
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: [OT] Sync vs ASync Server Comms
  • Next by Date: Re: Objective-C Question
  • Previous by thread: Re: [OT] Sync vs ASync Server Comms
  • Next by thread: Re: Objective-C Question
  • Index(es):
    • Date
    • Thread