• 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: Dynamic message typing problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic message typing problem


  • Subject: Re: Dynamic message typing problem
  • From: Bill Bumgarner <email@hidden>
  • Date: Fri, 16 May 2008 16:58:20 -0700

On May 16, 2008, at 4:51 PM, Julius Guzy wrote:
Thanks to all who replied to my pleas for help.
I took Bill and Scott's suggestions to heart and produced the answer I needed: Dynamic Typing which allows me to avoid circularity etc.

Good. BTW: Nice paintings.

I post the complete solution as an example and to check that I'm not running close to the wind by using a dummy class definition. The code gets no compiler warnings.

You don't need the dummy class.

I'd do it something like this (Mail Code -- this probably won't compile).

Only I'd also pull out all of the #imports and move to using a shared precomp for the project...

//  AnonTargetClass.h
#import <Cocoa/Cocoa.h>
@interface AnonTargetClass : NSObject {
}
- (void) printFloat:(float)pF;

//  AnonTargetClass.m
#import "AnonTargetClass.h"
@implementation AnonTargetClass
- (void) printFloat:(float)pF {
	NSLog(@"%7.3f",pF);
}

//  CallingClass.h
#import <Cocoa/Cocoa.h>

@class AnonTargetClass;
@interface CallingClass : NSObject {
}
- (void) callPrintConstFloat:(AnonTargetClass *)pId;
- (void) callPrint:(id)pId zFloat:(float)pF;

//  CallingClass.m
#import "CallingClass.h"
#import "AnonTargetClass.h"
@implementation CallingClass
- (void) callPrintConstFloat:(AnonTargetClass *)pId {
	[pId printFloat:99.99];
}
- (void) callPrint:(id)pId zFloat:(float)pF {
	[pId printFloat:pF];
}

//  main.m
#import <Cocoa/Cocoa.h>
#import "AnonTargetClass.h"
#import "CallingClass.h"

int main(int argc, char *argv[])
{
	AnonTargetClass 	* atcObj		= [[AnonTargetClass alloc]init];
	CallingClass			* callingObj	= [[CallingClass alloc]init];

	[callingObj callPrintConstFloat:atcObj];
	[atcObj printFloat:88.88];
}

_______________________________________________

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: Dynamic message typing problem
      • From: Julius Guzy <email@hidden>
References: 
 >Re: Dynamic message typing problem (From: Julius Guzy <email@hidden>)

  • Prev by Date: Re: The challenge for Cocoa's on-line documentation
  • Next by Date: Re: Dynamic message typing problem
  • Previous by thread: Re: Dynamic message typing problem
  • Next by thread: Re: Dynamic message typing problem
  • Index(es):
    • Date
    • Thread