Re: Calling Cocoa methods from C
Re: Calling Cocoa methods from C
- Subject: Re: Calling Cocoa methods from C
- From: Fawzi Mohamed <email@hidden>
- Date: Fri, 4 May 2001 14:40:19 +0200
Well in object oriented programming functions are always kept with the
data the act on. They are normally called methods and are seen to be
part of the object.
Thus you call a method you should always call it on an object. A method
of an object can call another method of the same object through "self".
If you call from a c function you cannot call methods on the same object
(there is no default object). You will have to call the method on a
precise object that you obtain by other means.
If your method does not need the context of the object, then you shoul
make it a class method (+ instread of -). Then (if you defined it in
MyClass) you will be able to call it with
[MyClass myMethod];
If you use obj-c calls from a function you should define it in a .m file.
Otherwise I think you should read:
/Developer/Documentation/Cocoa/ObjectiveC/ObjC.pdf
regards
Fawzi
On Friday, May 4, 2001, at 01:34 PM, Rosyna wrote:
How do i go about calling a Cocoa/Objc function I made in a C function.
If I do
[self methodName] I get an error message "self is not defined" The
calling function is designed as
void frontAndCenter(ProcessSerialNumber psn);
-- Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insane People
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev