Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: How to imitate Java inner class in Obj-C ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to imitate Java inner class in Obj-C ?




Le 18 déc. 04, à 07:13, Chris Hanson a écrit :

On Dec 17, 2004, at 1:16 PM, Kubernan @ 10191 Technologies wrote:
I have a little problem in my current rewriting of Java program in Objective-C.
The Java source code contains an inner class and i didn't find the best way
to implement this in Obj-C.
What should be the best approach in Objective-C allowing what inner class can do ?

What is the inner class in your Java code used for? I've usually seen inner classes used in Java for event/action listeners. If you're using Objective-C with Cocoa, handling events and actions is done in an entirely different way.

-- Chris

Thanks for you response,

The problem is the inner class is not used for event/action. The inner class in the Java source is used for accessing
instance variables of the "main" class as :


public class ClassB extends ClassA
{
/**
* This inner class
*/

protected class innerClass extends ClassC {
/**
* In this function innerClass use anInstance of ClassB
*/

public void foo() {

if (
anInstance.doSomething()) {

//blabla;
}
}
}//End of the inner class

/**
* The constructor of ClassB.
*/

public ClassB() {
anInstance = null;
}
}

I thought i could resolve this in Obj-C creating innerClass in a separated objective-C file and sharing (singleton) ClassB
but it doesn't work (may be i didn't well understand the goal of sharing instance ;-).

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

This email sent to email@hidden

References: 
 >How to imitate Java inner class in Obj-C ? (From: "Kubernan @ 10191 Technologies" <email@hidden>)
 >Re: How to imitate Java inner class in Obj-C ? (From: Chris Hanson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.