What is the equivalent of a C++ pure-virtual function in Objective-C?

前端 未结 2 1886
孤街浪徒
孤街浪徒 2021-02-08 13:06

Simple answer would be Protocol.

The another point is that it is said that all methods in ObjectC are virtual, so no need to say virtual in ObjC.

I find it hard

2条回答
  •  伪装坚强ぢ
    2021-02-08 13:20

    Methods on objects in Objective-C are not virtual functions, they are real functions.

    I beg to differ, methods in Obj-C aren't quite real like one would expect. They behave just like virtual functions in C++ do, except you cannot make a 'pure virtual' function in Objective-C.

    Cheers, Raxit

提交回复
热议问题