Calling a method from another class in Objective C

后端 未结 5 1001
鱼传尺愫
鱼传尺愫 2020-12-03 09:28

I have 2 classes, say class A and class B. Class B is created in class A. I have a method in class A, which needs to be executed in both class A and class B. Calling the me

5条回答
  •  情书的邮戳
    2020-12-03 09:49

    What you are looking is possible with Objective C.

    You can refer this post. But for that you have to learn some syntax of Objective C.

    If you are not familiar with Objective C & not direct deal with Cocoa frame work then you can do your work using Objective C++. Where you can write your code in C++.

    Here you can use function pointer & pass static method of class A.

    Or you can define interface class. Derive class A from that & pass object of A to class B.

提交回复
热议问题