How to implement nested classes in objective-c like Java?

11,591

From my understanding, Objective-C doesn't have inner classes.. Try these links where this question has been asked before:

How to access a variable from inner class

Private classes in Objective C

http://lists.apple.com/archives/objc-language/2004/Dec/msg00041.html

Share:
11,591
graffiti
Author by

graffiti

Updated on June 12, 2022

Comments

  • graffiti
    graffiti about 2 years

    I need to implement nested classes. How do I write it in objective-c?
    For example, I have such code:

    public class A {
        private int a;
        private B b;
    
        class B {
            private int z;
            public void f() {
                a = 1;
            }
        }
    
        public void fA() {
            b.f();
        }
    }
    

    How can I implement this code in objective-c??