When is it appropriate to use C as object oriented language?

前端 未结 3 1216
不思量自难忘°
不思量自难忘° 2021-02-06 13:27

There are a lot of excellent answers how can one simulate object oriented concepts with C. To name a few:

  • C double linked list with abstract data type
  • C a
3条回答
  •  半阙折子戏
    2021-02-06 13:48

    When you want a cross-platform foundation for object-oriented APIs. A case in point is Apple's Core Foundation. Being entirely C, it could be easily ported, yet provides an extremely rich set of opaque objects to use.

    A nice example of its flexibility is the way many of its types are 'toll-free' bridged with those from Foundation (a set of true OO Objective-C libraries). Many types from Core Foundation can be used, fairly naturally, in Foundation APIs, and vice-versa. It's hard to see this working so well without some OO concepts being present in the Core Foundation libraries.

提交回复
热议问题