Creating an abstract class in Objective-C

前端 未结 21 2494
感情败类
感情败类 2020-11-22 15:44

I\'m originally a Java programmer who now works with Objective-C. I\'d like to create an abstract class, but that doesn\'t appear to be possible in Objective-C. Is this poss

21条回答
  •  死守一世寂寞
    2020-11-22 16:09

    Can't you just create a delegate?

    A delegate is like an abstract base class in the sense that you say what functions need to be defined, but you don't actually define them.

    Then whenever you implement your delegate (i.e abstract class) you are warned by the compiler of what optional and mandatory functions you need to define behavior for.

    This sounds like an abstract base class to me.

提交回复
热议问题